All characters inside scripts are used for generation output, including spaces, line breaks, or carriage return characters.
Template content |
Actual output |
Expected output |
<gendoc>¶ |
¶ |
Allocations.¶ |
<drop/> tag allows to remove extra lines.
Document generation is internally performed in two steps and <drop/> tag removes the WHOLE paragraph in which it is contained so it must be handled with care.
First step is to analyze the lines to get as output to understand where the extra lines come from in the template and where the <drop/> tags should be located.
Template content |
Output |
|
<gendoc>¶ |
¶ |
|
<gendoc><drop/>¶ |
before <drop/> handling |
Final output |
<drop/>¶ |
Allocations.¶ Context.¶ LogicalView.¶ PhysicalView.¶ UseCases.¶ |
Tag <dropEmpty/> drop a paragraph if the tag content is empty.
The two following examples are equivalent:
<context model=’${model_path}’/>
<gendoc>
All comments on packages:
[for (p:Package|Package.allInstances()->sortedBy(name))]<drop/>
[for (c:Comment| p.ownedComment)]<drop/>
- Comment for package [p.name/]: <dropEmpty>[c._body/]</dropEmpty>
[/for]<drop/>
[/for]<drop/>
</gendoc>
<context model=’${model_path}’/>
<gendoc>
All comments on packages:
[for (p:Package|Package.allInstances()->sortedBy(name))]<drop/>
[for (c:Comment| p.ownedComment)]<drop/>
[if (not(c._body.oclIsUndefined()))]<drop/>
- Comment for package [p.name/]: [c._body/]
[/if]<drop/>
[/for]<drop/>
[/for]<drop/>
</gendoc>
Using tag <nobr/> allows to make template scripts easier to maintain, because code can be written on several paragraphs without displaying line breaks in output document, such as in the following example.
Template content |
Output |
<gendoc> |
Name: Actors |