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.

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''.

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"[2] 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)


[2] File xhtml.jar contains command xhtml.addBlock. "addBlockInFlow [p] pre" is strictly equivalent to "xhtml.addBlock pre".