Wiki

Clone wiki

Okapi / newDesign_Inline_Content

A content is made of Unicode characters and inline objects.

There are several types of inline object:

  • Original codes, representing non-textual content of the original format. Codes can be spans (like the representation of an HTML bold element) or placeholders (like the representation of an HTML BR element).
  • Markers, representing spans of content associated with one or more annotations.
  • Protected content, representing an hidden span of non-translatable content. This is a special type of object that denotes only a transient state and not part of the normal content.

These inline objects are represented in the content by tags. There are three types of tags:

  • Opening, representing the start of a span of content.
  • Closing, representing the end of a span of content.
  • Standalone, representing a position in the content.

Depending on the type of inline object you have the following possible combinations:

  • Original codes: opening, closing or standalone.
  • Markers: opening or closing.
  • Protected content: standalone.

A coded text is a Unicode string with normal text and tag references.

A tag reference is a pair of special characters representing a tag. The first character represents both the type of inline object and the type of tag the tag represents:

  • U+E101 CODE_OPENING
  • U+E102 CODE_CLOSING
  • U+E103 CODE_STANDALONE
  • U+E104 MARKER_OPENING
  • U+E105 MARKER_CLOSING
  • U+E106 PCONT_STANDALONE

The second character is a value between U+E110 and U+F8FF and represents the index for the given type of object/tag.

The two characters composing a tag reference are in the Private Use Area (PUA) range of Unicode and they have always distinct values.

A tag gives access to the inline object information. Spanning objects have some fields specific to their opening boundary, some fields specific to their closing boundary and fields common to both. Both the opening and closing tags of such object provides access to the same common fields. That is: if you change for example the type of an inline code using it's closing tag, the value of the field accessed from the opening tag changes too:

opening.setType("ui");
assertEquals("ui", closing.getType());
closing.setType("fmt");
assertEquals("fmt", opening.getType());
assertEquals("fmt", closing.getType());

The fields specific to each boundary (e.g. the user-friendly display) are set independently:

opening.setDisp("<<");
closing.setDisp(">>");
assertEquals("<<", opening.getDisp());
assertEquals(">>", closing.getDisp());

An annotation is some information pertaining to the content it is attached to. Annotations can be attached to annotation markers or original codes.

A protected content is a section of the content that must not be modified (e.g. translated) but is not represented as inline code. For example, the HTML content "<span translate='no'>text</span>" is a protected content. It includes at least the two tags that delimits the content, and it may contain other tags as well as some text.

Updated