43. makeParagraphs

Parameter syntax:

[ '[blocks]' ]? [ '[systemSelection]' ]? element_name

This command just returns a string and therefore, is useful only inside a macro-command.

Read text lines from the clipboard. For each text line, creates an element having specified name containing the text line. Returns an XML string containing the list of elements.

Example, if element_name is para and if the clipboard contains:

word1, word1, word1.
word2, word2, word2.

word3, word3, word3.
word4, word4, word4.

then the command returns:

<?xml version="1.0"?>
<ns:clipboard
xmlns:ns="http://www.xmlmind.com/xmleditor/namespace/clipboard"
><para
>word1, word1, word1.</para
><para
>word2, word2, word2.</para
><para
>word3, word3, word3.</para
><para
>word4, word4, word4.</para
></ns:clipboard
>
systemSelection

Read text lines from the system selection (only on Unix/X11) rather than from the clipboard.

blocks

Forces the command to convert multiple text lines separated by open lines to a single element. Without this option, each non-empty line is converted to an element.

Example, when this option is used, if element_name is para and if the clipboard contains:

word1, word1, word1.
word2, word2, word2.

word3, word3, word3.
word4, word4, word4.

then the command returns:

<?xml version="1.0"?>
<ns:clipboard
xmlns:ns="http://www.xmlmind.com/xmleditor/namespace/clipboard"
><para
>word1, word1, word1. word2, word2, word2.</para
><para
>word3, word3, word3. word4, word4, word4.</para
></ns:clipboard
>

Syntax examples:

makeParagraphs p
makeParagraphs [blocks] simpara
makeParagraphs [blocks][systemSelection] {http://www.foo.com/schema/bar}paragraph

DocBook example:

  <command name="insertAfterAsParagraphs">
    <macro>
      <sequence>
        <command name="makeParagraphs" parameter="%0" />
        <command name="paste" parameter="after[implicitElement] %_" />
      </sequence>
    </macro>
  </command>

  <binding>
    <keyPressed code="ESCAPE" />
    <charTyped char="w" />
    <command name="insertAfterAsParagraphs" parameter="para" />
  </binding>