Book a Demo

Author Topic: White space, new lines, in RTF templates  (Read 7386 times)

skiwi

  • EA Expert
  • ****
  • Posts: 2081
  • Karma: +46/-82
    • View Profile
White space, new lines, in RTF templates
« on: March 05, 2010, 09:53:17 am »
In my quest to produce professional looking documents OOTB I have been trying to understand how the RTF generator turns a template into a word document.

This issue appears to be that the RTF document generator either inconsistently handles newlines, or does not generate them when it should.

I have a document template with some debugging output, viz (I have added the # symbol to note numbering)

[highlight]package >[/highlight]
# {Pkg.Name}
{Pkg.Notes} [highlight]diagram >[/highlight]
{Diagram.DiagramImg}
Figure {Diagram.Figure}: {Diagram.Name}
{Diagram.Notes} [highlight]< diagram[/highlight] p [highlight]element >[/highlight]
#.# {Element.Name}
{Element.Notes}[highlight]model document >[/highlight]
[highlight]< model document[/highlight] m [highlight]diagram >[/highlight]
Figure {Diagram.DiagramImg}
{Diagram.Figure}: {Diagram.Name}
[highlight]< diagram[/highlight] d [highlight]child elements >[/highlight]
[highlight]< child elements[/highlight]
[highlight]< element[/highlight] e [highlight]child packages >[/highlight]
[highlight]< child packages[/highlight]
[highlight]< package[/highlight]

debugging output is the letters o m d and e

It seems to me that where one has

[highlight]diagram >[/highlight]
{Diagram.DiagramImg}
Figure {Diagram.Figure}: {Diagram.Name}
{Diagram.Notes} [highlight]< diagram[/highlight]

and there is no content at all to place between the [highlight]codes [/highlight](in this case "[highlight]diagram>[/highlight]") no white space, or newlines should be inserted in the text.

It also seems to me that where one has

[highlight]element >[/highlight]
#.# {Element.Name}
{Element.Notes}[highlight]model document >[/highlight]
[highlight]< model document[/highlight] [highlight]diagram >[/highlight]
Figure {Diagram.DiagramImg}
{Diagram.Figure}: {Diagram.Name}
[highlight]< diagram[/highlight] [highlight]child elements >[/highlight]
[highlight]< child element[/highlight]s
[highlight]< element[/highlight]

that the new line after the "[highlight]element >[/highlight]"  should always be generated - because a heading will always be generated.

In my testing it seems that this is not the case.
In some cases I have the heading being appended to the previous text, and thus the heading style wrongly applied.

There are other funnies too
When trying to place more than one code on a line (to reduce the number of empty lines that can be generated a space MUST be applied between the codes, viz [highlight]< diagram[/highlight] [highlight]child elements >[/highlight]

Also when working with the template, and inserting new sections existing codes can be overwritten, corrupting the template.
Surely this is just sloppy development and testing.

I have also tried [highlight]model document >[/highlight] [highlight]< model document[/highlight] and don't seem to have consistency between the generation of the first element encountered, and the child elements and child packages.

I would find a clear exposition of the rules relating to the insertion of content into the template, and the way while space and particularly newlines are handled.

Let me be clear about how I would like it to work.

I don't want to see empty lines created (ie multiple new lines with no content).
I want to handle all white space through document styles.
It would of course be better if the RTF editor handled paragraph formatting in a much better way, eg spacing before and after, keep lines together, keep with next, widow/orphan, but these seem to get lost in translation between normal.rtf and EA.

The RTF editor should alter content to the extent that for notes and linked documents the there should be one, and only one newline, no matter if the note or linked document has zero, two, or more newlines terminating it exactly one should be placed in the generated document (leading new lines and embedded new lines should be taken as is).

The generated document
« Last Edit: March 05, 2010, 10:13:34 am by skiwi »
Orthogonality rules
Position and Team disestablished, thanks austerity.
Now itinerant.