loading table of contents...

2.8.2. org.docma.plugin.examples.FormatLines

Arguments:
start=[INTEGER|off]
The line-numbering start value. Set to an integer value to enable line numbering. Set to off, to disable line numbering. Default is off.
line=STYLE_ID
The default block-style to be assigned to lines. If no default style is specified, and no other style defined by the arguments odd, even or mstyle is appropriate then no style is assigned to the line.
odd=STYLE_ID
The block-style to be assigned to odd lines.
even=STYLE_ID:
The block-style to be assigned to even lines.
num=STYLE_ID
The default block-style to be assigned to line-numbers. If no default style is specified, and no other style defined by the arguments onum, enum or mnum is appropriate, then the same style is assigned to the line-number as to the the line-content.
onum=STYLE_ID
The block-style to be assigned to odd line-numbers.
enum=STYLE_ID
The block-style to be assigned to even line-numbers.
cbox=STYLE_ID
Content-box style. The ID of the block-style to be assigned to the content-block. If cbox is not set, then the original style of the input-element is assigned. Note that if line-numbering is enabled, then this box does not include the line-numbers.
nbox=STYLE_ID
Numbering-box style. If line-numbering is enabled, this block-style is assigned to the box which encloses all line-numbers. If not specified, then no style is assigned. If line-numbering is disabled, then this setting has no effect.
box=STYLE_ID
Outer-box style. If line-numbering is enabled, this block-style is assigned to the outer-box which encloses the content and the line-numbers. If not specified, then no style is assigned to the outer-box. If line-numbering is disabled, then this setting has no effect.
keep=[auto|always]
The page break behaviour. Set to auto, to allow page breaks within the result-block. Set to always, to prevent page breaks within the result-block. Default is always.
nw=WIDTH
The horizontal space that is reserved for the line-numbers. If not specified, then the default width of 32pt is used.
maxcols=INTEGER
The maximum number of characters per line. If the maximum number of characters is reached, then an automatic line-break is inserted. Automatically inserted line-breaks do not increase the line-number. Set to 0, to disable automatic line-breaks. Default is 0 (disabled).
lbc=[CHARACTER]
The automatic line-break character. If an automatic line break is inserted due to the maxcols argument, then CHARACTER is inserted at the end of the broken line to indicate that the line is continued on the next line. If not specified or set to empty string, then no line-break character is inserted. CHARACTER has to be a single character or a character entity, e.g. "…".
pre=[true|false]
Indication whether input is preformatted or not. If set to true, line-break characters in the XHTML source cause line breaks in the rendered output. Otherwise only <br /> elements are rendered as line breaks. Default is false.
tab=INTEGER
The tab size. If the specified integer value is positive, then tab characters are transformed to the number of spaces given by this value. If the integer value is 0 or the argument is missing, then tab characters are not transformed.
m=PATTERN
The marker pattern. If a line contains the character sequence PATTERN, then the line is highlighted with the styles given by the arguments mstyle and mnum. If not specified, then highlighting is disabled.
mstyle=STYLE_ID
The ID of the block-style to be assigned to marked lines. If not specified, then no style is assigned to marked lines.
mnum=STYLE_ID
The ID of the block-style to be assigned to the line numbers of marked lines. If not specified, then no style is assigned to the line-numbers of marked lines.
Notes:
If the arguments onum and/or enum are provided, then the specified styles should have the same margin, padding and font-size values as the styles specified for the arguments line, odd and even. Otherwise the line-numbers may not be in line with the corresponding lines of the content.
Setting the argument maxcols to a positive value only makes sense for preformatted text which is rendered with a fixed-width font (i.e. the line style should include the CSS properties font-family: monospace and white-space: pre).
Inline arguments:
Besides setting the arguments in the Auto-Format style defintion (see examples below), the arguments can also be set as first line of the input-element. For this, the first line must be provided in the format [args: arg1=value1 arg2=value2 ... ]. If the same argument is set in the Auto-Format style definition and in the first line of the input, then the later takes precedence. For example, following input-element sets the line-numbering start value to 3, overwriting any start value that was set in the Auto-Format configuration of the style listing:
<div class="listing">
  [args: start=3]<br/>
  Line 1<br/>
  Line 2<br/>
</div>
Referencing lines:
If a line contains an inline-element, i.e. contains text thas was formatted with an inline-style, and the inline-element has an id-attribute assigned, but no title-attribute, then the title-attribute is set to the line-number. This way it is possible, to create references to inline-elements, where the link text is automatically replaced by the line number of the referenced element (i.e. you can create text like "see line x"), where x is a link whose link-text is replaced during export by the line-number.
An alternative way of referencing lines, is to mark the line and attach an ID to the marker. The marker pattern is defined by the argument m=PATTERN (see description of the arguments above). To attach an ID to a marker, put the ID in square brackets after the marker. For example, if you have set the argument m=###, then you can mark a line and assign the ID line_a to it, by placing the substring "###[line_a]" somewhere within the line.
Be aware that an ID has to start with a letter or underscore and must only contain letters, digits, underscores or dashes.
Examples:
Following Auto-Format style configuration transforms the input into a formatted listing with line-numbers, where the style line_style is applied to lines. The line-numbering starts with 1. A horizontal space of 28pt is reserved for the line-numbers. Furthermore the content and the line-numbers are enclosed in a box with style listing_frame:
org.docma.plugin.examples.FormatLines start=1
                                      line=line_style
                                      nw=28pt
                                      box=listing_frame
Following configuration transforms the input into a formatted listing without line-numbers. The character sequence '###' can be used to mark lines. Marked lines are highlighted with style red_line. Page breaks are allowed within the listing:
org.docma.plugin.examples.FormatLines start=off m=###
                                      mstyle=red_line
                                      keep=auto