General XMetaL Discussion
achu April 27, 2010 at 4:06 pm
disable text layoutApril 27, 2010 at 4:06 pmParticipants 2Replies 3Last Activity 12 years, 2 months ago
By switching to the text view, the XMetal will apply text layout automatically according to your CTM settings.
However, the line breaks XMetal insert are not the “soft” line break. It removes the original line breaks as well as inserts the new line breaks.
Is there a way to disable/enable text layout on the fly?Derek Read April 28, 2010 at 1:25 am
Reply to: disable text layoutApril 28, 2010 at 1:25 am
There is no real way to do this. The only possibility I can think of is to have two CTM files and switch between them (perhaps by renaming the files on disk) but that would require reloading the XML document ActiveDocument.Reload().
Not sure what you need this for. Perhaps you could elaborate on the ultimate goal so we can figure out if it can be done, or if we might want to add a feature to help you out.
I should also state that I'm a little confused because Pretty Printing (when enabled in the CTM) does not only apply when you switch to Plain Text view, it is applied to the file on disk when you save from TagsOn or Normal view. So, really you either have Pretty Printing turned on (in which case Plain Text view will match what you see when saving from TagsOn or Normal) or you have it turned off (and in this case, again, it should match).achu April 28, 2010 at 3:40 pm
Reply to: disable text layoutApril 28, 2010 at 3:40 pm
Sometimes, the line break in XML means something, we don't actually want to get rid off it. Ideally, We anticipate that the view in the editor should be just another way to present data without changing the actual data.
Here is what we attempt to achieve.
Pass XML string to XMAX for review and editing.
As an option, editor may switch to plain text view. The reason we applying pretty print is to increase readability for raw xml and limit the usage of horizontal scroll.
After completion of editing in XMAX, return Document.xml string for the next process. At this point, the xml string return from document.xml is inserted with additional line breaks due to pretty printing setting and original line breaks are gone.Derek Read April 28, 2010 at 6:23 pm
Reply to: disable text layoutApril 28, 2010 at 6:23 pm
The only way to have both features at the same time is to turn pretty printing on (globally) and configure how each element should be pretty printed, which includes turning it off entirely on individual elements where white-space should be considered significant. This is done using the “preserve space” option. That tells the pretty printer to skip over those elements when pretty printing the document (which is done when saving).
- You must be logged in to reply to this topic.