4. addBlockInFlow

Parameter syntax:

[ '['inline_container_element_name']' S ]? block_element_name|block_element_template

Intelligently adds specified block element after the text node containing the caret or after the explicitly selected element.

block_element_name, block_element_template

Specifies the element to be inserted.

inline_container_element_name

Specifies an element which can contain a mix of text and inline elements. XHTML example: p. DocBook example: simpara (but not para which can also contain blocks). This element is needed to teach to the command which are the inline elements of the document type.

When this optional parameter is missing, the list of inline elements is parsed from the value of system property "configuration_name inlineElementNames". This property may contain a list of fully qualified element names and/or "container(container_element_name)" shorthands. See TEI example below.

Initially, this command has been designed to deal with XHTML elements such as li, dd, th, td, div, which not only can contain blocks (p, ul, table, etc), but can also contain a mix of text and inline elements (b, i, em, a, etc). This kind of content model is called a “flow”.

Example 6.1. XHTML example

<ul>
              +--- caret is here
              |
              v
  <li><b>First|</b> item.</li>
  <li><b>Second</b> item.</li>
</ul>

Generic command "add after[implicitElement] {http://www.w3.org/1999/xhtml}pre" gives:

<ul>
  <li><b>First</b> item.</li>
  <li><b>Second</b> item.</li>
</ul>
<pre>|</pre>

Smarter command "addBlockInFlow [p] {http://www.w3.org/1999/xhtml}pre" gives:

<ul>
  <li><b>First</b> item.
      <pre>|</pre>
  </li>
  <li><b>Second</b> item.</li>
</ul>

Examples:

addBlockInFlow [p] table
addBlockInFlow [p] #template({http://www.w3.org/1999/xhtml}table,head_row)

Example 6.2. TEI example

<property name="$c inlineElementNames">
  {http://www.tei-c.org/ns/1.0}abbr
  {http://www.tei-c.org/ns/1.0}add
  ...
  container({http://www.tei-c.org/ns/1.0}pc)1
  ...
  {http://www.tei-c.org/ns/1.0}w
</property>

addBlockInFlow2 {http://www.tei-c.org/ns/1.0}table

1

container({http://www.tei-c.org/ns/1.0}pc) means any child element of {http://www.tei-c.org/ns/1.0}pc.

2

Because property "$c inlineElementNames" is defined, parameter inline_container_element_name is not needed by addBlockInFlow.