Advanced bidi support

There are many properties that you can set to enable bidirectional support in document-style reports.

Bidi properties in the templates

Some of the template elements have the direction property. The value of this property can be set to ltr (left-to-right), rtl (right-to-left), contextual or empty (the default setting). If the value of this property is empty, the direction of the corresponding element is inherited or has a default for the current document value.

The following template elements have the direction property:
  • Container, Paragraph, Table Cell, List Item: The property affects each logical paragraph of the text, for which the direction is not explicitly defined.
  • Table : The property defines the way of displaying columns and affects each cell, for which the direction is not explicitly defined.
  • List: The property affects each list item for which the direction is not explicitly defined.
  • Text: The property affects the content of the current element only. It cannot be inherited from or by other elements.
You can set the direction property from the Properties view in Document Studio.
Direction property set in the Properties view

Bidi properties in the document specifications

The following bidi-specific properties of the runtime metadata are used to control layout of the generated document-style report and base direction of its text contents.

Type Value Description
bidi true, false (default) Used as a trigger to switch on or off bidi-specific functionality.
document direction ltr, rtl Defines the layout of the document-style report. If both document direction and output locale metadata properties are empty, document direction is set to ltr.If document direction is empty, its actual runtime value depends on the value of output locale property. For bidi locales this is rtl. For other locales this is ltr.
text direction ltr, rtl, contextual,empty (default) Defines the base text direction.empty means that the default text direction is the same as the document direction.
In Launcher, you can set properties by the Properties view or by the Configure Metadata Properties window:
Setting bidi properties in the Properties view for document specifications
Bidi properties can be referenced from Engineering Publishing templates using the internal variable _sessionInfo:
Session info in a script expression
From the products which use the built-in Engineering Document Generation, bidi properties can be set programmatically. For example, in the case of Engineering Requirements Management DOORS® Next, the code might look like this:
LocalDocumentGenerator docGen = new LocalDocumentGenerator(new EDGEngineImpl());
    String config = docGen.getConfigurationPath(configFolder.toURI());
    DocumentSpecificationBuilder builder = new DocumentSpecificationBuilder();
    PUBDocumentSpecification docSpec = builder.create(config);
    PUBMetadata metadata = docSpec.getRuntime().getMetadata();
    metadata.addProperty(new Property(PUBConfigConstants.PROPERTY_DOCUMENT_DIRECTION, new Value("","rtl"));

Determining elements and base text direction of their contents at runtime

The direction of the element specifies alignment, layout and the base text direction of its contents.

Container ,Paragraph, Table ,Table Cell, List and List Item have their own direction property. If the value of this property is empty, the actual direction of the corresponding element is inherited from the closest ascendant, having a non-empty direction property. If it turns out that there is nothing to inherit, the direction of element is defined by the document direction property of the document-style report.

If Container ,Paragraph, Table ,Table Cell, List or List Item have their own or inherited contextual direction property, the actual direction of these elements is determined by their text contents. However, if this is not possible (either the text is not placed into the current element directly or it contains neutral characters only), the actual direction is inherited from the closest ascendant, having a non-empty and non-contextual direction property. If it turns out that there is nothing to inherit, the direction of element is defined by the text direction property of the document-style report.

If Container ,Paragraph, Table ,Table Cell, List or List Item have a Text element with a non-empty direction property as their first direct child, the actual direction of such elements is determined from the resolved direction of this Text element.

If Table or List have their own or inherited contextual direction property, the actual direction of these elements is inherited from the closest ascendant, having a non-empty and non-contextual direction property. If it turns out that there is nothing to inherit, the direction of the element is defined by the document direction property of the document-style report.

If the direction of the Text element is not empty, the contents of this element (which can be only the part of the logical paragraph) appear in the generated document-style report as an isolated segment of the text, formatted in accordance with this property. If the Text element has its own contextual direction property, the base direction of the corresponding text segment is determined from its contents. If the text segment contains only neutral characters, the base text direction is defined by the text direction property of the document-style report.

The direction of Table Of Contents, Table Of Tables and Table Of Figures is defined by the document direction property of the document-style report. It specifies their layout (for example, the relative positions of the section numbers, their names and page numbers) only. Text in the names of a section, for any direction of these elements, should look the same as it appears in the body of the document-style report.

The direction of Table Caption and Figure Caption is defined by the document direction property of the document-style report. It specifies their layout (for example, the relative positions of the labels and contents). The base text direction of each part of captions is defined by the text direction property of the document-style report.

The direction of Footnote is defined by the document direction property of the document-style report. It specifies the layout of the contents (for example, the relative positions of the footnote number, its contents and their alignment). The base text direction of the footnote's contents is defined by the text direction property of the document-style report.

The direction of Comment is undefined. The base text direction of its contents is defined by the text direction property of the document-style report.

The direction of Header and Footer is defined by the document direction property of the document-style report.

Handling Rich Text (XHTML)

The contents of the Text element can be presented by XHTML fragments. These fragments are parsed and handled as collections of template elements:
  • P, H1-H6 - as paragraphs with different styles
  • DIV - as Container
  • TABLE - as Table
  • TD - as Table Cell
  • OL,UL - as Lists
  • LI - as List Item

The values of style direction and attribute dir found in the block-level html elements such as P, DIV, H1-H6, LI, TD, as well as in the TABLE, OL and UL, are recognized and converted into the Engineering Publishing formatting property direction. If both the style and attribute are defined for the current html element, the value of dir is used.Set content for current element

The contents of block-level html elements are handled as a sequence of text elements with different styles. You can use SPAN elements in HTML with the style direction. These SPAN elements are handled as a text element having the style direction property. (However, these elements should not contain any additional markup inside. SPAN elements with additional markup are not supported and might cause unexpected results.)