TextTemplate¶
TextTemplate¶
Syntax¶
<TextTemplate rootSectionName="...">
<FileFormat ... />
<Output ... />
<TextSections>
<TextSection ... />
</TextSections>
</TextTemplate>
Parameters¶
Parameter | Description | Default | Remark |
---|---|---|---|
rootSectionName1 | The name of the root section. | _template_ |
Child sections¶
Section | Description |
---|---|
FileFormat2 | See FileFormat |
Output2 | See Output |
TextSection | See TextSection |
FileFormat¶
Syntax¶
<FileFormat
...
singleLineCommentPrefix="..."
multiLineCommentPrefix="..."
multiLineCommentSuffix="..."
/>
Parameters¶
Parameter | Description | Default | Remark |
---|---|---|---|
... | Click here to see the generic FileFormat options. | ||
singleLineCommentPrefix1 | The single line comment prefix. | ||
multiLineCommentPrefix | The multi-line comment prefix. | ||
multiLineCommentSuffix | The multi-line comment suffix. |
TextSection¶
The TextSection configuration defines a section in a text template. This can either be defined in the template part of the config or in the template directly. The syntax here is provided for in the configuration, but the same parameters are also available when specifying the section inline in a template using the TextSection annotation.
Syntax¶
<TextSection
name="..."
[
optional="..."
]
[
placeholderName="..."
]
[
begin="..."
includeBegin="..."
end="..."
includeEnd="..."
literalOnFirstLine="..."
literalOnLastLine="..."
nrOfLines="..."
]
[
prefix="..."
prefixStyle="..."
prefixAction="..."
]
[
suffix="..."
suffixStyle="..."
suffixAction="..."
]
[
lineSeparator="..."
]
/>
Parameters¶
Parameter | Description | Default | Remark |
---|---|---|---|
name1 | The name of the section. | This can only contain a-z, A-Z, 0-9, _ and - characters. | |
optional4 | Indicates if the section is optional (true/false). | false | Can be used to suppress warnings in case of a reused config, where sections defined in the config do not occur in each template the config is used with. |
placeholderName | An optional override for the placeholderName coming from the SectionModelBinding. | Can be used to provide a specific placeholder name to use within the section. | |
begin3 | Character sequence which defines the beginning of the section. | If begin is not specified, it will automatically start on the first line after the annotation. This can thus only be done with an inline annotation. | |
includeBegin | Whether to include the characters specified in begin in the output |
true | |
end3 | Character sequence which defines the end of the section. | Cannot be used in conjunction with nrOfLines . |
|
includeEnd | Whether to include the characters specified in end in the output |
true | |
literalOnFirstLine3 | Literal which exists on the first line of the section, the whole line will be taken into the section. | Cannot be used in conjunction with begin . |
|
literalOnLastLine3 | Literal which exists on the last line of the section, the whole line will be taken into the section. | Cannot be used in conjunction with end or nrOfLines . |
|
nrOfLines3 | Defines the number of lines of the section starting after the line containing the @XGenSection annotation. Any lines containing another (section) annotation should also be included. |
1 | Cannot be used in conjunction with end or literalOnLastLine . |
prefix | The prefix to prepend using the prefixStyle . |
||
prefixStyle | The style of the prefix, see Prefix & suffix styles | allButFirst | Only interpreted when prefix is given. |
prefixAction | The action to be performed with the prefix, either add or remove. | add | Only interpreted when prefix is given. Only add is supported at the moment. |
suffix | The suffix to append using the suffxStyle . |
||
suffixStyle | The style of the suffix, see Prefix & suffix styles | allButLast | Only interpreted when suffix is given. |
suffixAction | The action to be performed with the suffix, either add or remove. | add | Only interpreted when suffix is given. Only add is supported at the moment. |
lineSeparator | The string literal which represents a line separator within this section. | \r?\n | By default this is the line separator as specified in the FileFormatConfig which is applicable for the template part this annotation is in. For a text template it will be the main TextTemplate configuration element. For a XML template, it will be the respective TextTemplate element in the TextTemplates collection. |
Prefix & suffix styles¶
Style | Description |
---|---|
firstOnly | Only apply the suffix or prefix on the first repetition of the section. |
lastOnly | Only apply the suffix or prefix on the last repetition of the section. |
allButFirst | Apply the suffix or prefix on all repetition of the section, except the first. |
allButLast | Apply the suffix or prefix on all repetition of the section, except the last. |
allButFirstAndLast | Apply the suffix or prefix on all repetition of the section, except the first and last. |
all | Apply the suffix or prefix on all repetition of the section. |
-
At least one of these parameters must be specified when using this annotation in the template section of the config file. When using this annotation inline in a template and none of these parameters are specified, the default value for nrOfLines will be used and the section will start at the first line after the annotation. ↩↩↩↩↩
-
An option which can only be specified in the config. ↩