General XMetaL Discussion
Crispness January 13, 2009 at 10:43 am
‘lines too long’ error messageJanuary 13, 2009 at 10:43 amParticipants 3Replies 4Last Activity 14 years ago
I have a VB macro which creates automatically creates a standard format table for our users.
It uses a series of simple code instructions like
[code]if Selection.FindInsertLocation(“row”) then
Selection.ElementAttribute(“valign”, “row”) = “top”
if Selection.FindInsertLocation(“entry”) then
Selection.ElementAttribute(“align”, “entry”) = “right”
The problem is that when it runs it generates an error message saying something like
There are one or more lines in this document that are too long to be displayed. They have been broken into smaller lines.
You can restore the document to its original condition by choosing 'undo' from the edit menu.
To avoid this problem in the future, you can enable text layout in the Customisations settings under the Tools menu
Can someone explain how to suppress the error message?
TIADerek Read January 14, 2009 at 12:12 am
Reply to: ‘lines too long’ error messageJanuary 14, 2009 at 12:12 am
I'm assuming you only see this message when you switch to Plain Text view and that (given the way the script has been written) you are only running your script in TagsOn or Normal view. XMetaL Author has a maximum number of characters that it prefers to display on a single line, at which point it displays the message you are seeing.
To avoid this you should turn on Pretty Printing for your customization. This is done in the CTM file associated with your DTD or Schema by adding appropriate settings for each element that needs to be Pretty Printed (in this case, one option would be to set this for, at a minumum, your row element). A general section can also be included that controls Pretty Printing.
If you are not the person in charge of managing your XMetaL customizations please check with that person before making changes. There are cases where you may wish to intentionally disable Pretty Printing for compatibility with other software when that software does not like Pretty Printing at all or if it has specific requirements for it (some CMS or VCS systems for example).
Note: If you are working with DITA documents (which seems unlikely, though you may be adding scripts on top of our DITA customization) then to turn on Pretty Printing you can simply run the “DITA Configuration: Turn ON Pretty Printing” listed in the Macros toolbar's dropdown list. In this case pre-configured CTM files specifically designed for DITA will be enabled.
You should normally edit CTM files using XMetaL Developer, though they can be edited manually provided you do not mess up the format (they are plain text XML files). Please keep in mind that editing CTM files with XMetaL Developer 5.0 will introduce a bug specific to the Pretty Printing settings (which will be addressed in our next release). Pretty Printing settings are written out incorrectly as follows:
This needs to be manually corrected in a text editor (or by using a previous release of XMetaL Developer or XMetaL 3.1) to properly close the
element by moving the closing tag after the final option that should be contained within it as follows:
To enable Pretty Printing the CTM file must also not have a
element inside the . Make sure you read the previous sentence again to be sure you understand my intentional double negative.
If IndentAmount and MaxLineLength are omitted they default to the values above.
With proper Pretty Printing settings enabled you should not see your issue.
The Journalist example customization that ships with XMetaL Author Enterprise has Pretty Printing turned on by default so you may wish to view the journalist.ctm file here as an example:
Rulesjournalist.ctmCrispness January 14, 2009 at 7:06 am
Reply to: ‘lines too long’ error messageJanuary 14, 2009 at 7:06 am
Will look at doing that tmrw.Crispness January 14, 2009 at 4:01 pm
Reply to: ‘lines too long’ error messageJanuary 14, 2009 at 4:01 pm
The help files in Developer (I'm on 4.6) urge caution around enabling prettyprinting, in that extra white space may be added to the original file. Effectively the long lines are only a problem in
elements and its children, and only in Plain Text view.
But as I read it, I need to
- Enable PrettyPrinting for the entire DTD, and then
- Disable it everywhere except within
elements or its children
Am I reading that correctly?Derek Read January 14, 2009 at 9:08 pm
Reply to: ‘lines too long’ error messageJanuary 14, 2009 at 9:08 pm
You sort of understand, but perhaps a little bit backwards.
Pretty Printing is enabled in the CTM's
section, but it does not affect any element unless that element has a section defined in the CTM, and then you have 10 different options for each element which provides quite a bit of flexibility:
In addition to those 9 you can use the following for elements that should not have their content modified (usually used for elements whose content that may contain whitespace that is significant, such as the equivalent of a pre element in XHTML).
So, you would enable pretty printing for the DTD and then turn it on for those elements you need pretty printed, in your case setting it on row and nothing else might be good enough.
- You must be logged in to reply to this topic.