4. addBlockInFlow
Prev | Chapter 6. Commands written in the Java™ programming language | Next

## 4. addBlockInFlow

Parameter syntax:

    '['inline_container_element_name']' S block_element_name

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

block_element_name

  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] p`re" gives:

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

Smarter command "`addBlockInFlow [p] pre`"[2] gives:

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

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

Prev | Up | Next
3. addAttribute | Home | 5. autoSpellChecker