summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Hazel <ph10@hermes.cam.ac.uk>2007-04-10 11:30:34 +0000
committerNigel Metheringham <nigel@exim.org>2010-06-09 12:42:07 +0000
commit4f307ce2d96bae1c86f9d3d9e6de73caae10f1b9 (patch)
tree5257f6aab2035b9099d0b587ff579601c55abef8
parent44bd711f68c13d22f580012249b458f2ce2168d4 (diff)
downloadexim4-4f307ce2d96bae1c86f9d3d9e6de73caae10f1b9.tar.gz
Imported from /Users/nigel/Work/x/xfpt-0.02.tar.bz2.
-rw-r--r--doc/xfpt.html251
-rw-r--r--doc/xfpt.pdfbin56783 -> 58771 bytes
-rw-r--r--doc/xfpt.xfpt62
-rw-r--r--share/stdmacs20
-rw-r--r--src/dot.c118
-rw-r--r--src/error.c2
-rw-r--r--src/globals.c2
-rw-r--r--testing/infiles/01111
-rw-r--r--testing/infiles/021
-rw-r--r--testing/outfiles/0177
-rw-r--r--testing/outfiles/021
-rw-r--r--testing/outfiles/02.err46
12 files changed, 525 insertions, 166 deletions
diff --git a/doc/xfpt.html b/doc/xfpt.html
index f8d0825bd..ad3069017 100644
--- a/doc/xfpt.html
+++ b/doc/xfpt.html
@@ -54,7 +54,7 @@ The xfpt plain text to XML processor</title>
<div>
<div>
<h1 class="title">
-<a id="id2434747">
+<a id="id2433571">
</a>
The xfpt plain text to XML processor</h1>
</div>
@@ -83,9 +83,9 @@ Revision History</b>
</tr>
<tr>
<td align="left">
-Revision 0.01</td>
+Revision 0.02</td>
<td align="left">
-22 March 2007</td>
+10 April 2007</td>
<td align="left">
PH</td>
</tr>
@@ -103,7 +103,7 @@ Table of Contents</b>
<dl>
<dt>
<span xmlns="" class="chapter">
-<a id="toc0001" href="#id2527527">
+<a id="toc0001" href="#id2527524">
1. Introduction</a>
</span>
</dt>
@@ -111,7 +111,7 @@ Table of Contents</b>
<dl>
<dt>
<span xmlns="" class="section">
-<a id="toc0002" href="#id2489706">
+<a id="toc0002" href="#id2489713">
1.1. The <span xmlns="http://www.w3.org/1999/xhtml" class="emphasis">
<em>
xfpt</em>
@@ -121,7 +121,7 @@ command line</a>
</dt>
<dt>
<span xmlns="" class="section">
-<a id="toc0003" href="#id2491606">
+<a id="toc0003" href="#id2491619">
1.2. A short <span xmlns="http://www.w3.org/1999/xhtml" class="emphasis">
<em>
xfpt</em>
@@ -137,7 +137,7 @@ example</a>
</dt>
<dt>
<span xmlns="" class="section">
-<a id="toc0005" href="#id2490011">
+<a id="toc0005" href="#id2490024">
1.4. Format of directive lines</a>
</span>
</dt>
@@ -151,7 +151,7 @@ example</a>
</dd>
<dt>
<span xmlns="" class="chapter">
-<a id="toc0007" href="#id2490257">
+<a id="toc0007" href="#id2490270">
2. Flag sequences</a>
</span>
</dt>
@@ -159,7 +159,7 @@ example</a>
<dl>
<dt>
<span xmlns="" class="section">
-<a id="toc0008" href="#id2490310">
+<a id="toc0008" href="#id2490323">
2.1. Flag sequences for XML entities and <span xmlns="http://www.w3.org/1999/xhtml" class="emphasis">
<em>
xfpt</em>
@@ -169,25 +169,25 @@ variables</a>
</dt>
<dt>
<span xmlns="" class="section">
-<a id="toc0009" href="#id2536952">
+<a id="toc0009" href="#id2536958">
2.2. Flag sequences for calling macros</a>
</span>
</dt>
<dt>
<span xmlns="" class="section">
-<a id="toc0010" href="#id2536973">
+<a id="toc0010" href="#id2536978">
2.3. Other flag sequences</a>
</span>
</dt>
<dt>
<span xmlns="" class="section">
-<a id="toc0011" href="#id2537117">
+<a id="toc0011" href="#id2537122">
2.4. Unrecognized flag sequences</a>
</span>
</dt>
<dt>
<span xmlns="" class="section">
-<a id="toc0012" href="#id2537129">
+<a id="toc0012" href="#id2537135">
2.5. Standard flag sequences</a>
</span>
</dt>
@@ -195,7 +195,7 @@ variables</a>
</dd>
<dt>
<span xmlns="" class="chapter">
-<a id="toc0013" href="#id2537370">
+<a id="toc0013" href="#id2537375">
3. Built-in directive processing</a>
</span>
</dt>
@@ -203,7 +203,7 @@ variables</a>
<dl>
<dt>
<span xmlns="" class="section">
-<a id="toc0014" href="#id2537392">
+<a id="toc0014" href="#id2537397">
3.1. The <span xmlns="http://www.w3.org/1999/xhtml" class="bold">
<strong>
.arg</strong>
@@ -213,7 +213,7 @@ directive</a>
</dt>
<dt>
<span xmlns="" class="section">
-<a id="toc0015" href="#id2537436">
+<a id="toc0015" href="#id2537451">
3.2. The <span xmlns="http://www.w3.org/1999/xhtml" class="bold">
<strong>
.eacharg</strong>
@@ -223,7 +223,7 @@ directive</a>
</dt>
<dt>
<span xmlns="" class="section">
-<a id="toc0016" href="#id2537573">
+<a id="toc0016" href="#id2537607">
3.3. The <span xmlns="http://www.w3.org/1999/xhtml" class="bold">
<strong>
.echo</strong>
@@ -233,7 +233,7 @@ directive</a>
</dt>
<dt>
<span xmlns="" class="section">
-<a id="toc0017" href="#id2537594">
+<a id="toc0017" href="#id2537627">
3.4. The <span xmlns="http://www.w3.org/1999/xhtml" class="bold">
<strong>
.endarg</strong>
@@ -243,7 +243,7 @@ directive</a>
</dt>
<dt>
<span xmlns="" class="section">
-<a id="toc0018" href="#id2537616">
+<a id="toc0018" href="#id2537650">
3.5. The <span xmlns="http://www.w3.org/1999/xhtml" class="bold">
<strong>
.endeach</strong>
@@ -253,79 +253,109 @@ directive</a>
</dt>
<dt>
<span xmlns="" class="section">
-<a id="toc0019" href="#id2537639">
+<a id="toc0019" href="#id2537672">
3.6. The <span xmlns="http://www.w3.org/1999/xhtml" class="bold">
<strong>
-.flag</strong>
+.endinliteral</strong>
</span>
directive</a>
</span>
</dt>
<dt>
<span xmlns="" class="section">
-<a id="toc0020" href="#id2537674">
+<a id="toc0020" href="#id2537695">
3.7. The <span xmlns="http://www.w3.org/1999/xhtml" class="bold">
<strong>
-.include</strong>
+.flag</strong>
</span>
directive</a>
</span>
</dt>
<dt>
<span xmlns="" class="section">
-<a id="toc0021" href="#id2537699">
+<a id="toc0021" href="#id2537730">
3.8. The <span xmlns="http://www.w3.org/1999/xhtml" class="bold">
<strong>
-.literal</strong>
+.include</strong>
</span>
directive</a>
</span>
</dt>
<dt>
<span xmlns="" class="section">
-<a id="toc0022" href="#SECTmacro">
+<a id="toc0022" href="#id2537755">
3.9. The <span xmlns="http://www.w3.org/1999/xhtml" class="bold">
<strong>
-.macro</strong>
+.inliteral</strong>
</span>
directive</a>
</span>
</dt>
<dt>
<span xmlns="" class="section">
-<a id="toc0023" href="#id2537915">
+<a id="toc0023" href="#id2537801">
3.10. The <span xmlns="http://www.w3.org/1999/xhtml" class="bold">
<strong>
-.pop</strong>
+.literal</strong>
</span>
directive</a>
</span>
</dt>
<dt>
<span xmlns="" class="section">
-<a id="toc0024" href="#id2537976">
+<a id="toc0024" href="#SECTmacro">
3.11. The <span xmlns="http://www.w3.org/1999/xhtml" class="bold">
<strong>
-.push</strong>
+.macro</strong>
</span>
directive</a>
</span>
</dt>
<dt>
<span xmlns="" class="section">
-<a id="toc0025" href="#SECTrevision">
+<a id="toc0025" href="#id2538016">
3.12. The <span xmlns="http://www.w3.org/1999/xhtml" class="bold">
<strong>
-.revision</strong>
+.nonl</strong>
</span>
directive</a>
</span>
</dt>
<dt>
<span xmlns="" class="section">
-<a id="toc0026" href="#id2538201">
+<a id="toc0026" href="#id2538043">
3.13. The <span xmlns="http://www.w3.org/1999/xhtml" class="bold">
<strong>
+.pop</strong>
+</span>
+directive</a>
+</span>
+</dt>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0027" href="#id2538104">
+3.14. The <span xmlns="http://www.w3.org/1999/xhtml" class="bold">
+<strong>
+.push</strong>
+</span>
+directive</a>
+</span>
+</dt>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0028" href="#SECTrevision">
+3.15. The <span xmlns="http://www.w3.org/1999/xhtml" class="bold">
+<strong>
+.revision</strong>
+</span>
+directive</a>
+</span>
+</dt>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0029" href="#id2538330">
+3.16. The <span xmlns="http://www.w3.org/1999/xhtml" class="bold">
+<strong>
.set</strong>
</span>
directive</a>
@@ -335,7 +365,7 @@ directive</a>
</dd>
<dt>
<span xmlns="" class="chapter">
-<a id="toc0027" href="#CHAPstdmac">
+<a id="toc0030" href="#CHAPstdmac">
4. The standard macros for DocBook</a>
</span>
</dt>
@@ -343,73 +373,73 @@ directive</a>
<dl>
<dt>
<span xmlns="" class="section">
-<a id="toc0028" href="#id2538305">
+<a id="toc0031" href="#id2538433">
4.1. Overall setup</a>
</span>
</dt>
<dt>
<span xmlns="" class="section">
-<a id="toc0029" href="#id2538362">
+<a id="toc0032" href="#id2538490">
4.2. Chapters, sections, and subsections</a>
</span>
</dt>
<dt>
<span xmlns="" class="section">
-<a id="toc0030" href="#id2538468">
+<a id="toc0033" href="#id2538597">
4.3. URL references</a>
</span>
</dt>
<dt>
<span xmlns="" class="section">
-<a id="toc0031" href="#id2538538">
+<a id="toc0034" href="#id2538666">
4.4. Itemized lists</a>
</span>
</dt>
<dt>
<span xmlns="" class="section">
-<a id="toc0032" href="#id2538612">
+<a id="toc0035" href="#id2538740">
4.5. Ordered lists</a>
</span>
</dt>
<dt>
<span xmlns="" class="section">
-<a id="toc0033" href="#id2538704">
+<a id="toc0036" href="#id2538833">
4.6. Variable lists</a>
</span>
</dt>
<dt>
<span xmlns="" class="section">
-<a id="toc0034" href="#id2538759">
+<a id="toc0037" href="#id2538887">
4.7. Nested lists</a>
</span>
</dt>
<dt>
<span xmlns="" class="section">
-<a id="toc0035" href="#id2538780">
+<a id="toc0038" href="#id2538909">
4.8. Displayed text</a>
</span>
</dt>
<dt>
<span xmlns="" class="section">
-<a id="toc0036" href="#id2538892">
+<a id="toc0039" href="#id2539021">
4.9. Block quotes</a>
</span>
</dt>
<dt>
<span xmlns="" class="section">
-<a id="toc0037" href="#SECTrevmacs">
+<a id="toc0040" href="#SECTrevmacs">
4.10. Revision markings</a>
</span>
</dt>
<dt>
<span xmlns="" class="section">
-<a id="toc0038" href="#id2539050">
+<a id="toc0041" href="#id2539248">
4.11. Informal tables</a>
</span>
</dt>
<dt>
<span xmlns="" class="section">
-<a id="toc0039" href="#id2539326">
+<a id="toc0042" href="#id2539524">
4.12. Indexes</a>
</span>
</dt>
@@ -417,7 +447,7 @@ directive</a>
</dd>
</dl>
</div>
-<div class="chapter" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a href="#" id="id2527527">1. Introduction</a></h2></div></div></div><p><span class="emphasis"><em>xfpt</em></span> is a program that reads a marked-up ASCII source file, and converts it into
+<div class="chapter" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a href="#" id="id2527524">1. Introduction</a></h2></div></div></div><p><span class="emphasis"><em>xfpt</em></span> is a program that reads a marked-up ASCII source file, and converts it into
XML. It was written with DocBook XML in mind, but can also be used for other
forms of XML. Unlike <span class="emphasis"><em>AsciiDoc</em></span> (<span class="bold"><strong><a href="http://www.methods.co.nz/asciidoc/" target="_top">http://www.methods.co.nz/asciidoc/</a></strong></span>),
<span class="emphasis"><em>xfpt</em></span> does not try to produce XML from a document that is also usable as a
@@ -461,7 +491,7 @@ Notwithstanding the previous paragraph, <span class="emphasis"><em>xfpt</em></sp
and in all cases when a literal ampersand or angle bracket is required in the
output, the appropriate XML entity reference (<code class="literal">&amp;amp;</code>, <code class="literal">&amp;lt;</code>, or
<code class="literal">&amp;gt;</code>, respectively) is generated.
-</p><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2489706">1.1 The <span xmlns="http://www.w3.org/1999/xhtml" class="emphasis"><em>xfpt</em></span> command line</a></h3></div></div></div><p>The format of the <span class="emphasis"><em>xfpt</em></span> command line is:
+</p><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2489713">1.1 The <span xmlns="http://www.w3.org/1999/xhtml" class="emphasis"><em>xfpt</em></span> command line</a></h3></div></div></div><p>The format of the <span class="emphasis"><em>xfpt</em></span> command line is:
</p><div class="literallayout">
 <code class="literal">xfpt [</code><span class="emphasis"><em>options</em></span><code class="literal">] [</code><span class="emphasis"><em>input source</em></span><code class="literal">]</code><br />
</div><p>
@@ -483,7 +513,7 @@ be given as an output destination to refer to the standard output.
</div><p>
This option overrides the path to <span class="emphasis"><em>xfpt</em></span>’s library directory that is built into
the program. This makes it possible to use or test alternate libraries.
-</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2491606">1.2 A short <span xmlns="http://www.w3.org/1999/xhtml" class="emphasis"><em>xfpt</em></span> example</a></h3></div></div></div><p>Here is a very short example of a complete <span class="emphasis"><em>xfpt</em></span> input file that uses some of the
+</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2491619">1.2 A short <span xmlns="http://www.w3.org/1999/xhtml" class="emphasis"><em>xfpt</em></span> example</a></h3></div></div></div><p>Here is a very short example of a complete <span class="emphasis"><em>xfpt</em></span> input file that uses some of the
standard macros and flags:
</p><pre class="literallayout">
.include stdflags
@@ -539,7 +569,8 @@ output. An example might be the <code class="literal">&lt;bookinfo&gt;</code> el
in a document. It is not worth setting up a macro for a one-off item like this.
</p></li></ul></div><p>
The <span class="bold"><strong>.literal</strong></span> directive switches between the modes. It is not normally used
-directly, but instead is incorported into appropriate macro definitions.
+directly, but instead is incorported into appropriate macro definitions. The
+<span class="bold"><strong>.inliteral</strong></span> directive can be used to test the current mode.
</p><p>
Directive lines are recognized and acted upon in all four modes. However, an
unrecognized line that starts with a dot in the literal text or literal XML
@@ -562,7 +593,7 @@ to use literal layout mode if you require such output. Another solution, which
is used in the source for this document (where many examples show directive
lines), is to indent every displayed line by one space, and thereby avoid the
problem altogether.
-</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2490011">1.4 Format of directive lines</a></h3></div></div></div><p>If an input line starts with a dot followed by a space, it is ignored by <span class="emphasis"><em>xfpt</em></span>.
+</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2490024">1.4 Format of directive lines</a></h3></div></div></div><p>If an input line starts with a dot followed by a space, it is ignored by <span class="emphasis"><em>xfpt</em></span>.
This provides a facility for including comments in the input. Otherwise, the
dot must be followed by a directive or macro name, and possibly one or more
arguments. Arguments that are strings are delimited by white space unless they
@@ -577,7 +608,7 @@ An unrecognized directive line normally causes an error; however, in the
literal text and literal XML modes, an unrecognized line that starts with a
dot is treated as a data line.
</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="SECTcallingmacro">1.5 Calling macros</a></h3></div></div></div><p>Macros are defined by the <span class="bold"><strong>.macro</strong></span> directive, which is described in section
-<a href="#SECTmacro" title="3.9&#xA0;The .macro directive">3.9</a>. There are two ways of calling a macro. It can be called in the
+<a href="#SECTmacro" title="3.11&#xA0;The .macro directive">3.11</a>. There are two ways of calling a macro. It can be called in the
same way as a directive, or it can be called from within text that is being
processed. The second case is called an “<span class="quote">inline macro call</span>”.
</p><p>
@@ -611,7 +642,7 @@ A macro that can be called inline can always be called as a directive, but the
opposite is not always true. Macros are usually designed to be called either
one way or the other. However, the <span class="bold"><strong>.new</strong></span> and <span class="bold"><strong>.index</strong></span> macros in the
standard library are examples of macros that are designed be called either way.
-</p></div></div><div class="chapter" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a href="#" id="id2490257">2. Flag sequences</a></h2></div></div></div><p>Only one flag sequence is built-into the code itself. If an input line ends
+</p></div></div><div class="chapter" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a href="#" id="id2490270">2. Flag sequences</a></h2></div></div></div><p>Only one flag sequence is built-into the code itself. If an input line ends
with three ampersands (ignoring trailing white space), the ampersands are
removed, and the next input line, with any leading white space removed, is
joined to the original line. This happens before any other processing, and may
@@ -624,7 +655,7 @@ involve any number of lines. Thus:
produces exactly the same output as:
</p><pre class="literallayout">
The quick brown fox.
-</pre><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2490310">2.1 Flag sequences for XML entities and <span xmlns="http://www.w3.org/1999/xhtml" class="emphasis"><em>xfpt</em></span> variables</a></h3></div></div></div><p>If an ampersand is followed by a # character, a number, and a semicolon, it is
+</pre><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2490323">2.1 Flag sequences for XML entities and <span xmlns="http://www.w3.org/1999/xhtml" class="emphasis"><em>xfpt</em></span> variables</a></h3></div></div></div><p>If an ampersand is followed by a # character, a number, and a semicolon, it is
understood as a numerical reference to an XML entity, and is passed through
unmodified. The number can be decimal, or hexadecimal preceded by <code class="literal">x</code>. For
example:
@@ -648,11 +679,11 @@ of the previous types. In this case, the input text is passed to the output
without modification. For example:
</p><pre class="literallayout">
This is an Ohm sign: &amp;Ohm;.
-</pre></li></ul></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2536952">2.2 Flag sequences for calling macros</a></h3></div></div></div><p>If an ampersand is followed by a sequence of alphanumeric characters starting
+</pre></li></ul></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2536958">2.2 Flag sequences for calling macros</a></h3></div></div></div><p>If an ampersand is followed by a sequence of alphanumeric characters starting
with a letter, terminated by an opening parenthesis, the characters between the
ampersand and the parenthesis are interpreted as the name of a macro. See
section <a href="#SECTcallingmacro" title="1.5&#xA0;Calling macros">1.5</a> for more details.
-</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2536973">2.3 Other flag sequences</a></h3></div></div></div><p>Any other flag sequences that are needed must be defined by means of the
+</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2536978">2.3 Other flag sequences</a></h3></div></div></div><p>Any other flag sequences that are needed must be defined by means of the
<span class="bold"><strong>.flag</strong></span> directive. These are of two types, standalone and paired. Both cases
define replacement text. This is always literal; it is not itself scanned for
flag occurrences.
@@ -685,9 +716,9 @@ Note that, though <span class="emphasis"><em>xfpt</em></span> diagnoses an error
not prevent you from generating invalid XML. For example, DocBook does not
allow <code class="literal">&lt;emphasis&gt;</code> within <code class="literal">&lt;literal&gt;</code>, though it does allow <code class="literal">&lt;literal&gt;</code>
within <code class="literal">&lt;emphasis&gt;</code>.
-</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2537117">2.4 Unrecognized flag sequences</a></h3></div></div></div><p>If an ampersand is not followed by a character sequence in one of the forms
+</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2537122">2.4 Unrecognized flag sequences</a></h3></div></div></div><p>If an ampersand is not followed by a character sequence in one of the forms
described in the preceding sections, an error occurs.
-</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2537129">2.5 Standard flag sequences</a></h3></div></div></div><p>These are the standalone flag sequences that are defined in the <em class="filename">stdflags</em>
+</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2537135">2.5 Standard flag sequences</a></h3></div></div></div><p>These are the standalone flag sequences that are defined in the <em class="filename">stdflags</em>
file in the <span class="emphasis"><em>xfpt</em></span> library:
</p><div class="literallayout">
 <code class="literal">&amp;&amp;        </code> becomes <code class="literal"> &amp;amp;</code> (ampersand)<br />
@@ -713,10 +744,10 @@ For example, if you want to include a literal XML element in your output, you
can do it like this: <code class="literal">&amp;&lt;element&gt;&amp;</code>. If you want to include a longer
sequence of literal XML, changing to the literal XML mode may be more
convenient.
-</p></div></div><div class="chapter" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a href="#" id="id2537370">3. Built-in directive processing</a></h2></div></div></div><p>The directives that are built into the code of <span class="emphasis"><em>xfpt</em></span> are now described in
+</p></div></div><div class="chapter" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a href="#" id="id2537375">3. Built-in directive processing</a></h2></div></div></div><p>The directives that are built into the code of <span class="emphasis"><em>xfpt</em></span> are now described in
alphabetical order. You can see more examples of their use in the definitions
of the standard macros in chapter <a href="#CHAPstdmac" title="4.&#xA0;The standard macros for DocBook">4</a>.
-</p><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2537392">3.1 The <span xmlns="http://www.w3.org/1999/xhtml" class="bold"><strong>.arg</strong></span> directive</a></h3></div></div></div><p>This directive may appear only within the body of a macro. It must be followed
+</p><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2537397">3.1 The <span xmlns="http://www.w3.org/1999/xhtml" class="bold"><strong>.arg</strong></span> directive</a></h3></div></div></div><p>This directive may appear only within the body of a macro. It must be followed
by a single number, optionally preceded by a minus sign. If the number is
positive (no minus sign), subsequent lines, up to a <span class="bold"><strong>.endarg</strong></span> directive, are
skipped unless the macro has been called with at least that number of
@@ -736,16 +767,20 @@ for the given argument. For example:
and the second one is not empty.
.endarg
.endmacro
-</pre></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2537436">3.2 The <span xmlns="http://www.w3.org/1999/xhtml" class="bold"><strong>.eacharg</strong></span> directive</a></h3></div></div></div><p>This directive may appear only within the body of a macro. It may optionally be
+</pre><p>
+The <span class="bold"><strong>.arg</strong></span> directive may be nested.
+</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2537451">3.2 The <span xmlns="http://www.w3.org/1999/xhtml" class="bold"><strong>.eacharg</strong></span> directive</a></h3></div></div></div><p>This directive may appear only within the body of a macro. It may optionally be
followed by a single number; if omitted the value is taken to be 1. Subsequent
lines, up to a <span class="bold"><strong>.endeach</strong></span> directive, are processed multiple times, once for
each remaining argument. Unlike <span class="bold"><strong>.arg</strong></span>, an argument that is an empty string
is not treated specially.
</p><p>
-The number given with <span class="bold"><strong>.eacharg</strong></span> defines which argument to start with. While
-these lines are being processed, the remaining macro arguments can be
-referenced relative to the current argument. <code class="literal">$+1</code> refers to the current
-argument, <code class="literal">$+2</code> to the next argument, and so on.
+The number given with <span class="bold"><strong>.eacharg</strong></span> defines which argument to start with. If the
+macro is called with fewer arguments, the lines up to <span class="bold"><strong>.endeach</strong></span> are skipped,
+and are not processed at all. When these lines are being processed, the
+remaining macro arguments can be referenced relative to the current argument.
+<code class="literal">$+1</code> refers to the current argument, <code class="literal">$+2</code> to the next argument, and so
+on.
</p><p>
The <span class="bold"><strong>.endeach</strong></span> directive may also be followed by a number, again defaulting
to 1. When <span class="bold"><strong>.endeach</strong></span> is reached, the current argument number is incremented
@@ -766,13 +801,17 @@ fifth argument:
.eacharg 5
&amp;&lt;colspec colwidth="$+1" align="$+2"/&gt;&amp;
.endeach 2
-</pre></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2537573">3.3 The <span xmlns="http://www.w3.org/1999/xhtml" class="bold"><strong>.echo</strong></span> directive</a></h3></div></div></div><p>This directive takes a single string argument. It writes it to the standard
+</pre><p>
+The <span class="bold"><strong>.eacharg</strong></span> directive may in principle be nested, though this does not
+seem useful in practice.
+</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2537607">3.3 The <span xmlns="http://www.w3.org/1999/xhtml" class="bold"><strong>.echo</strong></span> directive</a></h3></div></div></div><p>This directive takes a single string argument. It writes it to the standard
error stream. Within a macro, argument substitution takes place, but no other
processing is done on the string. This directive can be useful for debugging
macros or writing comments to the user.
-</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2537594">3.4 The <span xmlns="http://www.w3.org/1999/xhtml" class="bold"><strong>.endarg</strong></span> directive</a></h3></div></div></div><p>See the description of <span class="bold"><strong>.arg</strong></span> above.
-</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2537616">3.5 The <span xmlns="http://www.w3.org/1999/xhtml" class="bold"><strong>.endeach</strong></span> directive</a></h3></div></div></div><p>See the description of <span class="bold"><strong>.eacharg</strong></span> above.
-</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2537639">3.6 The <span xmlns="http://www.w3.org/1999/xhtml" class="bold"><strong>.flag</strong></span> directive</a></h3></div></div></div><p>This directive is used to define flag sequences. The directive must be followed
+</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2537627">3.4 The <span xmlns="http://www.w3.org/1999/xhtml" class="bold"><strong>.endarg</strong></span> directive</a></h3></div></div></div><p>See the description of <span class="bold"><strong>.arg</strong></span> above.
+</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2537650">3.5 The <span xmlns="http://www.w3.org/1999/xhtml" class="bold"><strong>.endeach</strong></span> directive</a></h3></div></div></div><p>See the description of <span class="bold"><strong>.eacharg</strong></span> above.
+</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2537672">3.6 The <span xmlns="http://www.w3.org/1999/xhtml" class="bold"><strong>.endinliteral</strong></span> directive</a></h3></div></div></div><p>See the description of <span class="bold"><strong>.inliteral</strong></span> below.
+</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2537695">3.7 The <span xmlns="http://www.w3.org/1999/xhtml" class="bold"><strong>.flag</strong></span> directive</a></h3></div></div></div><p>This directive is used to define flag sequences. The directive must be followed
either by a standalone flag sequence and one string in quotes, or by a flag
pair and two strings in quotes. White space separates these items. For example:
</p><pre class="literallayout">
@@ -782,17 +821,22 @@ pair and two strings in quotes. White space separates these items. For example:
There are more examples in the definitions of the standard flags. If you
redefine an existing flag, the new definition overrides the old. There is no
way to revert to the previous definition.
-</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2537674">3.7 The <span xmlns="http://www.w3.org/1999/xhtml" class="bold"><strong>.include</strong></span> directive</a></h3></div></div></div><p>This directive must be followed by a single string argument that is the path to
+</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2537730">3.8 The <span xmlns="http://www.w3.org/1999/xhtml" class="bold"><strong>.include</strong></span> directive</a></h3></div></div></div><p>This directive must be followed by a single string argument that is the path to
a file. The contents of the file are read and incorporated into the input at
this point. If the string does not contain any slashes, the path to the <span class="emphasis"><em>xfpt</em></span>
library is prepended. Otherwise, the path is used unaltered.
-</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2537699">3.8 The <span xmlns="http://www.w3.org/1999/xhtml" class="bold"><strong>.literal</strong></span> directive</a></h3></div></div></div><p>This must be followed by one of the words “<span class="quote">layout</span>”, “<span class="quote">text</span>”, “<span class="quote">off</span>”, or
+</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2537755">3.9 The <span xmlns="http://www.w3.org/1999/xhtml" class="bold"><strong>.inliteral</strong></span> directive</a></h3></div></div></div><p>This directive may appear only within the body of a macro. It must be followed
+by one of the words “<span class="quote">layout</span>”, “<span class="quote">text</span>”, “<span class="quote">off</span>”, or “<span class="quote">xml</span>”. If the current
+literal mode does not correspond to the word, subsequent lines, up to a
+<span class="bold"><strong>.endinliteral</strong></span> directive, are skipped. The <span class="bold"><strong>.inliteral</strong></span> directive may be
+nested.
+</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2537801">3.10 The <span xmlns="http://www.w3.org/1999/xhtml" class="bold"><strong>.literal</strong></span> directive</a></h3></div></div></div><p>This must be followed by one of the words “<span class="quote">layout</span>”, “<span class="quote">text</span>”, “<span class="quote">off</span>”, or
“<span class="quote">xml</span>”. It forces an end to a previous paragraph, if there is one, and then
switches between processing modes. The default mode is the “<span class="quote">off</span>” mode, in
which text is processed paragraph by paragraph, and flags are recognized.
Section <a href="#SECTliteralprocessing" title="1.3&#xA0;Literal and non-literal processing">1.3</a> describes how input lines are processed in
the four modes.
-</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="SECTmacro">3.9 The <span xmlns="http://www.w3.org/1999/xhtml" class="bold"><strong>.macro</strong></span> directive</a></h3></div></div></div><p>This directive is used to define macros. It must be followed by a macro name,
+</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="SECTmacro">3.11 The <span xmlns="http://www.w3.org/1999/xhtml" class="bold"><strong>.macro</strong></span> directive</a></h3></div></div></div><p>This directive is used to define macros. It must be followed by a macro name,
and then, optionally, by any number of arguments. The macro name can be any
sequence of non-whitespace characters. The arguments in the definition provide
default values. The following lines, up to <span class="bold"><strong>.endmacro</strong></span>, form the body of the
@@ -844,7 +888,11 @@ call it, because <span class="emphasis"><em>xfpt</em></span> looks for built-in
It is possible to define a macro within a macro, though clearly care must be
taken with argument references to ensure that substitutions happen at the right
level.
-</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2537915">3.10 The <span xmlns="http://www.w3.org/1999/xhtml" class="bold"><strong>.pop</strong></span> directive</a></h3></div></div></div><p><span class="emphasis"><em>xfpt</em></span> keeps a stack of text strings that are manipulated by the <span class="bold"><strong>.push</strong></span> and
+</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2538016">3.12 The <span xmlns="http://www.w3.org/1999/xhtml" class="bold"><strong>.nonl</strong></span> directive</a></h3></div></div></div><p>This directive must be followed by a single string argument. It is processed
+as normal text, but without a newline at the end. This facility is useful in
+macros when constructing a single data line from several text fragments. See
+for example the <span class="bold"><strong>.new</strong></span> macro in the standard macros.
+</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2538043">3.13 The <span xmlns="http://www.w3.org/1999/xhtml" class="bold"><strong>.pop</strong></span> directive</a></h3></div></div></div><p><span class="emphasis"><em>xfpt</em></span> keeps a stack of text strings that are manipulated by the <span class="bold"><strong>.push</strong></span> and
<span class="bold"><strong>.pop</strong></span> directives. When the end of the input is reached, any strings that
remain on the stack are popped off, processed for flags, and written to the
output.
@@ -857,7 +905,7 @@ to and including the one that matches.
</p><p>
If <span class="bold"><strong>.pop</strong></span> is given without a following letter, it pops one string off the
stack and writes it out. If there is nothing on the stack, an error occurs.
-</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2537976">3.11 The <span xmlns="http://www.w3.org/1999/xhtml" class="bold"><strong>.push</strong></span> directive</a></h3></div></div></div><p>This directive pushes a string onto the stack. If the rest of the command line
+</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2538104">3.14 The <span xmlns="http://www.w3.org/1999/xhtml" class="bold"><strong>.push</strong></span> directive</a></h3></div></div></div><p>This directive pushes a string onto the stack. If the rest of the command line
starts with an upper case letter followed by white space, that letter is
associated with the string that is pushed, which consists of the rest of the
line. For example, the <span class="bold"><strong>.chapter</strong></span> macro contains this line:
@@ -870,7 +918,7 @@ Earlier in the macro there is the line:
</pre><p>
This arrangement ensures that any previous chapter is terminated before
starting a new one, and also when the end of the input is reached.
-</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="SECTrevision">3.12 The <span xmlns="http://www.w3.org/1999/xhtml" class="bold"><strong>.revision</strong></span> directive</a></h3></div></div></div><p>This directive is provided to make it easy to set the <code class="literal">revisionflag</code>
+</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="SECTrevision">3.15 The <span xmlns="http://www.w3.org/1999/xhtml" class="bold"><strong>.revision</strong></span> directive</a></h3></div></div></div><p>This directive is provided to make it easy to set the <code class="literal">revisionflag</code>
attribute on XML elements in a given portion of the document. The DocBook
specification states that the <code class="literal">revisionflag</code> attribute is common to all
elements.
@@ -900,7 +948,7 @@ though it does still seem to process it correctly.
For handling the most common case (setting and unsetting “<span class="quote">changed</span>”), the
standard macros <span class="bold"><strong>.new</strong></span> and <span class="bold"><strong>.wen</strong></span> are provided (see section
<a href="#SECTrevmacs" title="4.10&#xA0;Revision markings">4.10</a>).
-</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2538201">3.13 The <span xmlns="http://www.w3.org/1999/xhtml" class="bold"><strong>.set</strong></span> directive</a></h3></div></div></div><p>This directive must be followed by a name and a text string. It defines a user
+</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2538330">3.16 The <span xmlns="http://www.w3.org/1999/xhtml" class="bold"><strong>.set</strong></span> directive</a></h3></div></div></div><p>This directive must be followed by a name and a text string. It defines a user
variable and gives it a name. A reference to the name in the style of an XML
entity causes the string to be substituted, without further processing. For
example:
@@ -922,7 +970,7 @@ is going to use these features should start with:
All the standard macros except <span class="bold"><strong>new</strong></span>, <span class="bold"><strong>index</strong></span>, and <span class="bold"><strong>url</strong></span> are intended to
be called as directive lines. Their names are therefore shown with a leading
dot in the discussion below.
-</p><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2538305">4.1 Overall setup</a></h3></div></div></div><p>There are two macros that should be used only once, at the start of the
+</p><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2538433">4.1 Overall setup</a></h3></div></div></div><p>There are two macros that should be used only once, at the start of the
document. The <span class="bold"><strong>.docbook</strong></span> macro has no arguments. It inserts into the output
file the standard header material for a DocBook XML file, which is:
</p><pre class="literallayout">
@@ -932,7 +980,7 @@ file the standard header material for a DocBook XML file, which is:
</pre><p>
The <span class="bold"><strong>.book</strong></span> macro has no arguments. It generates <code class="literal">&lt;book&gt;</code> and pushes
<code class="literal">&lt;/book&gt;</code> onto the stack so that it will be output at the end.
-</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2538362">4.2 Chapters, sections, and subsections</a></h3></div></div></div><p>Chapters, sections, and subsections are supported by three macros that all
+</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2538490">4.2 Chapters, sections, and subsections</a></h3></div></div></div><p>Chapters, sections, and subsections are supported by three macros that all
operate in the same way. They are <span class="bold"><strong>.chapter</strong></span>, <span class="bold"><strong>.section</strong></span>, and
<span class="bold"><strong>.subsection</strong></span>. They take either one, two, or three arguments. The first
argument is the title. If a second argument is present, and is not an empty
@@ -964,7 +1012,7 @@ controlled by the stylesheet when the XML is processed.
These three macros use the stack to ensure that each chapter, section, and
subsection is terminated at the correct point. For example, starting a new
section automatically terminates an open subsection and a previous section.
-</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2538468">4.3 URL references</a></h3></div></div></div><p>The <span class="bold"><strong>url</strong></span> macro generates URL references, and is intended to be called inline
+</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2538597">4.3 URL references</a></h3></div></div></div><p>The <span class="bold"><strong>url</strong></span> macro generates URL references, and is intended to be called inline
within the text that is being processed. It generates a <code class="literal">&lt;ulink&gt;</code> element,
and has either one or two arguments. The first argument is the URL, and the
second is the text that describes it. For example:
@@ -979,7 +1027,7 @@ If the second argument is absent, the contents of the first argument are used
instead. If <span class="bold"><strong>url</strong></span> is called as a directive, there will be a newline in the
output after <code class="literal">&lt;/ulink&gt;</code>, which in most cases (such as the example above), you
do not want.
-</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2538538">4.4 Itemized lists</a></h3></div></div></div><p>The <span class="bold"><strong>.ilist</strong></span> macro marks the start of an itemized list, the items of which
+</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2538666">4.4 Itemized lists</a></h3></div></div></div><p>The <span class="bold"><strong>.ilist</strong></span> macro marks the start of an itemized list, the items of which
are normally rendered with bullets or similar markings. The macro can
optionally be called with one argument, for which there is no default. If the
argument is present, it is used to add a <code class="literal">mark=</code> attribute to the
@@ -998,7 +1046,7 @@ For example:
.endlist
</pre><p>
There may be more than one paragraph in an item.
-</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2538612">4.5 Ordered lists</a></h3></div></div></div><p>The <span class="bold"><strong>.olist</strong></span> macro marks the start of an ordered list, the items of which are
+</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2538740">4.5 Ordered lists</a></h3></div></div></div><p>The <span class="bold"><strong>.olist</strong></span> macro marks the start of an ordered list, the items of which are
numbered. If no argument is given, arabic numerals are used. One of the
following words can be given as the macro’s argument to specify the numeration:
</p><div class="literallayout">
@@ -1019,7 +1067,7 @@ For example:
.endlist
</pre><p>
There may be more than one paragraph in an item.
-</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2538704">4.6 Variable lists</a></h3></div></div></div><p>A variable list is one in which each entry is composed of a set of one or more
+</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2538833">4.6 Variable lists</a></h3></div></div></div><p>A variable list is one in which each entry is composed of a set of one or more
terms and an associated description. Typically, the terms are printed in a
style that makes them stand out, and the description is indented underneath.
The start of a variable list is indicated by the <span class="bold"><strong>.vlist</strong></span> macro, which has
@@ -1037,12 +1085,12 @@ This is followed by the body of the entry. The list is terminated by the
.endlist
</pre><p>
As for the other lists, there may be more than one paragraph in an item.
-</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2538759">4.7 Nested lists</a></h3></div></div></div><p>Lists may be nested as required. Some DocBook processors automatically choose
+</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2538887">4.7 Nested lists</a></h3></div></div></div><p>Lists may be nested as required. Some DocBook processors automatically choose
different bullets for nested itemized lists, but others do not. The
<span class="bold"><strong>.endlist</strong></span> macro has no useful arguments. Any text that follows it is
treated as a comment. This can provide an annotation facility that may make the
input easier to understand when lists are nested.
-</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2538780">4.8 Displayed text</a></h3></div></div></div><p>In displayed text each non-directive input line generates one output line. The
+</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2538909">4.8 Displayed text</a></h3></div></div></div><p>In displayed text each non-directive input line generates one output line. The
<code class="literal">&lt;literallayout&gt;</code> DocBook element is used to achieve this. Two kinds of
displayed text are supported by the standard macros. They differ in their
handling of the text itself.
@@ -1073,10 +1121,10 @@ monospaced font. For example:
</pre><p>
As the examples illustrate, both kinds of display are terminated by the
<span class="bold"><strong>.endd</strong></span> macro.
-</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2538892">4.9 Block quotes</a></h3></div></div></div><p>The macro pair <span class="bold"><strong>.blockquote</strong></span> and <span class="bold"><strong>.endblockquote</strong></span> are used to wrap the
+</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2539021">4.9 Block quotes</a></h3></div></div></div><p>The macro pair <span class="bold"><strong>.blockquote</strong></span> and <span class="bold"><strong>.endblockquote</strong></span> are used to wrap the
lines between them in a <code class="literal">&lt;blockquote&gt;</code> element.
</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="SECTrevmacs">4.10 Revision markings</a></h3></div></div></div><p>Two macros are provided to simplify setting and unsetting the “<span class="quote">changed</span>”
-revision marking (see section <a href="#SECTrevision" title="3.12&#xA0;The .revision directive">3.12</a>). When the revised text is
+revision marking (see section <a href="#SECTrevision" title="3.15&#xA0;The .revision directive">3.15</a>). When the revised text is
substantial (for example, a complete paragraph, table, display, or section), it
can be placed between <span class="bold"><strong>.new</strong></span> and <span class="bold"><strong>.wen</strong></span>, as in this example:
</p><pre class="literallayout">
@@ -1090,10 +1138,11 @@ can be placed between <span class="bold"><strong>.new</strong></span> and <span
.wen
Here is the next, unmarked, paragraph.
</pre><p>
-When called like this, without an argument, <span class="bold"><strong>.new</strong></span> terminates the current
-paragraph, and <span class="bold"><strong>.wen</strong></span> always does so. Therefore, even though there are no
-blank lines before <span class="bold"><strong>.new</strong></span> or <span class="bold"><strong>.wen</strong></span> above, the revised text will end up in
-a paragraph of its own. (You can, of course, put in blank lines if you wish.)
+When called like this, without an argument, in ordinary text, <span class="bold"><strong>.new</strong></span>
+terminates the current paragraph, and <span class="bold"><strong>.wen</strong></span> always does so. Therefore, even
+though there are no blank lines before <span class="bold"><strong>.new</strong></span> or <span class="bold"><strong>.wen</strong></span> above, the revised
+text will end up in a paragraph of its own. (You can, of course, put in blank
+lines if you wish.)
</p><p>
If want to indicate that just a few words inside a paragraph are revised, you
can call the <span class="bold"><strong>new</strong></span> macro with an argument. The macro can be called either as
@@ -1105,7 +1154,23 @@ a directive or inline:
</pre><p>
The effect of this is to generate a <code class="literal">&lt;phrase&gt;</code> XML element with the
<code class="literal">revisionflag</code> attribute set. The <span class="bold"><strong>.wen</strong></span> macro is not used in this case.
-</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2539050">4.11 Informal tables</a></h3></div></div></div><p>The <span class="bold"><strong>.itable</strong></span> macro starts an informal (untitled) table with some basic
+</p><p>
+You can use the <span class="bold"><strong>.new</strong></span>/<span class="bold"><strong>.wen</strong></span> macro pair to generate a <code class="literal">&lt;phrase&gt;</code> element
+inside a section of displayed text. For example:
+</p><pre class="literallayout">
+ .display
+ This line is not flagged as changed.
+ .new
+ This line is flagged as changed.
+ .wen
+ This line is not flagged as changed.
+ .endd
+</pre><p>
+This usage works with both <span class="bold"><strong>.display</strong></span> and <span class="bold"><strong>.code</strong></span>. Within a <span class="bold"><strong>.display</strong></span>
+section you can also call <span class="bold"><strong>.new</strong></span> with an argument, either as a directive or
+inline. This does not work for <span class="bold"><strong>.code</strong></span> because its lines are processed in
+literal text mode.
+</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2539248">4.11 Informal tables</a></h3></div></div></div><p>The <span class="bold"><strong>.itable</strong></span> macro starts an informal (untitled) table with some basic
parameterization. If you are working on a large document that has many tables
with the same parameters, the best approach is to define your own table macros,
possibly calling the standard one with specific arguments.
@@ -1152,7 +1217,7 @@ The <span class="bold"><strong>.row</strong></span> macro does not set the <code
all current XML processors. However, you can use an inline call of the <span class="bold"><strong>new</strong></span>
macro within an entry to generate a <code class="literal">&lt;phrase&gt;</code> element with <code class="literal">revisionflag</code>
set.
-</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2539326">4.12 Indexes</a></h3></div></div></div><p>The <span class="bold"><strong>.index</strong></span> macro generates <code class="literal">&lt;indexterm&gt;</code> elements (index entries) in the
+</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="#" id="id2539524">4.12 Indexes</a></h3></div></div></div><p>The <span class="bold"><strong>.index</strong></span> macro generates <code class="literal">&lt;indexterm&gt;</code> elements (index entries) in the
output. It takes one or two arguments. The first is the text for the primary
index term, and the second, if present, specifies a secondary index term. This
macro can be called either from a directive line, or inline. However, it is
diff --git a/doc/xfpt.pdf b/doc/xfpt.pdf
index dce5c18a4..8e2dc330c 100644
--- a/doc/xfpt.pdf
+++ b/doc/xfpt.pdf
Binary files differ
diff --git a/doc/xfpt.xfpt b/doc/xfpt.xfpt
index 552846cff..b2e5d3cb0 100644
--- a/doc/xfpt.xfpt
+++ b/doc/xfpt.xfpt
@@ -13,13 +13,13 @@
<bookinfo>
<title>The xfpt plain text to XML processor</title>
<titleabbrev>xfpt</titleabbrev>
-<date>22 March 2007</date>
+<date>10 April 2007</date>
<author>
<firstname>Philip</firstname>
<surname>Hazel</surname>
</author>
<authorinitials>PH</authorinitials>
-<revhistory><revision><revnumber>0.01</revnumber><date>22 March 2007</date><authorinitials>PH</authorinitials></revision></revhistory>
+<revhistory><revision><revnumber>0.02</revnumber><date>10 April 2007</date><authorinitials>PH</authorinitials></revision></revhistory>
<copyright><year>2007</year><holder>University of Cambridge</holder></copyright>
</bookinfo>
.literal off
@@ -183,7 +183,8 @@ in a document. It is not worth setting up a macro for a one-off item like this.
.endlist
The &*.literal*& directive switches between the modes. It is not normally used
-directly, but instead is incorported into appropriate macro definitions.
+directly, but instead is incorported into appropriate macro definitions. The
+&*.inliteral*& directive can be used to test the current mode.
Directive lines are recognized and acted upon in all four modes. However, an
unrecognized line that starts with a dot in the literal text or literal XML
@@ -426,6 +427,7 @@ for the given argument. For example:
.endarg
.endmacro
.endd
+The &*.arg*& directive may be nested.
.section "The &*.eacharg*& directive"
@@ -435,10 +437,12 @@ lines, up to a &*.endeach*& directive, are processed multiple times, once for
each remaining argument. Unlike &*.arg*&, an argument that is an empty string
is not treated specially.
-The number given with &*.eacharg*& defines which argument to start with. While
-these lines are being processed, the remaining macro arguments can be
-referenced relative to the current argument. &`$+1`& refers to the current
-argument, &`$+2`& to the next argument, and so on.
+The number given with &*.eacharg*& defines which argument to start with. If the
+macro is called with fewer arguments, the lines up to &*.endeach*& are skipped,
+and are not processed at all. When these lines are being processed, the
+remaining macro arguments can be referenced relative to the current argument.
+&`$+1`& refers to the current argument, &`$+2`& to the next argument, and so
+on.
The &*.endeach*& directive may also be followed by a number, again defaulting
to 1. When &*.endeach*& is reached, the current argument number is incremented
@@ -460,6 +464,8 @@ fifth argument:
&<colspec colwidth="$+1" align="$+2"/>&
.endeach 2
.endd
+The &*.eacharg*& directive may in principle be nested, though this does not
+seem useful in practice.
.section "The &*.echo*& directive"
@@ -476,6 +482,9 @@ See the description of &*.arg*& above.
.section "The &*.endeach*& directive"
See the description of &*.eacharg*& above.
+.section "The &*.endinliteral*& directive"
+See the description of &*.inliteral*& below.
+
.section "The &*.flag*& directive"
This directive is used to define flag sequences. The directive must be followed
@@ -496,6 +505,13 @@ a file. The contents of the file are read and incorporated into the input at
this point. If the string does not contain any slashes, the path to the &X;
library is prepended. Otherwise, the path is used unaltered.
+.section "The &*.inliteral*& directive"
+This directive may appear only within the body of a macro. It must be followed
+by one of the words &"layout"&, &"text"&, &"off"&, or &"xml"&. If the current
+literal mode does not correspond to the word, subsequent lines, up to a
+&*.endinliteral*& directive, are skipped. The &*.inliteral*& directive may be
+nested.
+
.section "The &*.literal*& directive"
This must be followed by one of the words &"layout"&, &"text"&, &"off"&, or
@@ -562,6 +578,13 @@ taken with argument references to ensure that substitutions happen at the right
level.
+.section "The &*.nonl*& directive"
+This directive must be followed by a single string argument. It is processed
+as normal text, but without a newline at the end. This facility is useful in
+macros when constructing a single data line from several text fragments. See
+for example the &*.new*& macro in the standard macros.
+
+
.section "The &*.pop*& directive"
&X; keeps a stack of text strings that are manipulated by the &*.push*& and
@@ -858,10 +881,11 @@ can be placed between &*.new*& and &*.wen*&, as in this example:
.wen
Here is the next, unmarked, paragraph.
.endd
-When called like this, without an argument, &*.new*& terminates the current
-paragraph, and &*.wen*& always does so. Therefore, even though there are no
-blank lines before &*.new*& or &*.wen*& above, the revised text will end up in
-a paragraph of its own. (You can, of course, put in blank lines if you wish.)
+When called like this, without an argument, in ordinary text, &*.new*&
+terminates the current paragraph, and &*.wen*& always does so. Therefore, even
+though there are no blank lines before &*.new*& or &*.wen*& above, the revised
+text will end up in a paragraph of its own. (You can, of course, put in blank
+lines if you wish.)
If want to indicate that just a few words inside a paragraph are revised, you
can call the &*new*& macro with an argument. The macro can be called either as
@@ -874,6 +898,22 @@ a directive or inline:
The effect of this is to generate a &`<phrase>`& XML element with the
&`revisionflag`& attribute set. The &*.wen*& macro is not used in this case.
+You can use the &*.new*&/&*.wen*& macro pair to generate a &`<phrase>`& element
+inside a section of displayed text. For example:
+.code
+ .display
+ This line is not flagged as changed.
+ .new
+ This line is flagged as changed.
+ .wen
+ This line is not flagged as changed.
+ .endd
+.endd
+This usage works with both &*.display*& and &*.code*&. Within a &*.display*&
+section you can also call &*.new*& with an argument, either as a directive or
+inline. This does not work for &*.code*& because its lines are processed in
+literal text mode.
+
.section "Informal tables"
The &*.itable*& macro starts an informal (untitled) table with some basic
diff --git a/share/stdmacs b/share/stdmacs
index 36e3c4ddd..662dae6cc 100644
--- a/share/stdmacs
+++ b/share/stdmacs
@@ -251,18 +251,38 @@
.macro new
.arg -1
+.inliteral off
.literal layout
.revision changed
.literal off
+.endinliteral
+.inliteral layout
+.nonl '&<phrase revisionflag="changed">&'
+.endinliteral
+.inliteral text
+.literal layout
+.nonl '&<phrase revisionflag="changed">&'
+.literal text
+.endinliteral
.endarg
.arg 1
&<phrase revisionflag="changed">&$1&</phrase>&
.endmacro
.macro wen
+.inliteral off
.literal layout
.revision off
.literal off
+.endinliteral
+.inliteral layout
+.nonl &</phrase>&
+.endinliteral
+.inliteral text
+.literal layout
+.nonl &</phrase>&
+.literal text
+.endinliteral
.endmacro
. End
diff --git a/src/dot.c b/src/dot.c
index 2e9949652..3c87166e3 100644
--- a/src/dot.c
+++ b/src/dot.c
@@ -2,7 +2,7 @@
* xfpt - Simple ASCII->Docbook processor *
*************************************************/
-/* Copyright (c) University of Cambridge, 2006 */
+/* Copyright (c) University of Cambridge, 2007 */
/* Written by Philip Hazel. */
/* This module contains code for processing a line that starts with a dot. */
@@ -51,21 +51,30 @@ return n;
*************************************************/
/* This function skips to the end of the current macro or to the given
-terminator line. It is called only when we know we are in a macro.
+terminator line. It is called only when we know we are in a macro. The current
+macro line is the conditional directive.
-Argument: the terminator directive
+Arguments:
+ s the conditional directive
+ t the terminator directive
Returns: nothing
*/
static void
-skipto(uschar *s)
+skipto(uschar *s, uschar *t)
{
-int length = Ustrlen(s);
+int nest = -1;
+int slength = Ustrlen(s);
+int tlength = Ustrlen(t);
BOOL done = macrocurrent->nextline == NULL;
while (!done)
{
uschar *p = macrocurrent->nextline->string;
- done = Ustrncmp(p, s, length) == 0 && (p[length] == 0 || isspace(p[length]));
+ done = Ustrncmp(p, t, tlength) == 0 &&
+ (p[tlength] == 0 || isspace(p[tlength])) &&
+ nest-- <= 0;
+ if (Ustrncmp(p, s, slength) == 0 && (p[slength] == 0 || isspace(p[slength])))
+ nest++;
macrocurrent->nextline = macrocurrent->nextline->next;
if (macrocurrent->nextline == NULL)
{
@@ -116,7 +125,7 @@ arg = macrocurrent->args;
for (i = 1; arg != NULL && i < argn; i++) arg = arg->next;
if (mustexist != (arg != NULL && arg->string[0] != 0))
- skipto(US".endarg");
+ skipto(US".arg", US".endarg");
}
@@ -149,7 +158,7 @@ for (i = 1; arg != NULL && i < argn; i++) arg = arg->next;
/* If we did not find the starting argument, skip. Otherwise, set up the
substitution for relative arguments, and remember where to come back to. */
-if (arg == NULL) skipto(US".endeach"); else
+if (arg == NULL) skipto(US"eacharg", US".endeach"); else
{
macro_argbase = arg;
macro_starteach = macrocurrent->nextline;
@@ -229,6 +238,26 @@ if (macro_argbase == NULL) macro_starteach = NULL;
/*************************************************
+* Handle .endinliteral *
+*************************************************/
+
+/* We only hit this as a stand-alone directive when in a literal section and
+the previous lines have been obeyed. There is nothing to do.
+
+Argument: the rest of the line
+Returns: nothing
+*/
+
+static void
+do_endinliteral(uschar *p)
+{
+if (macrocurrent == NULL) { error(15, US".endinliteral"); return; }
+if (*p != 0) error(19, ".endinliteral", p, 8, spaces, Ustrlen(p), circumflexes);
+}
+
+
+
+/*************************************************
* Handle .flag *
*************************************************/
@@ -347,6 +376,33 @@ if (ist->file == NULL) error(0, ist->filename, strerror(errno)); /* Hard */
+/*************************************************
+* Handle .inliteral *
+*************************************************/
+
+/* The .inliteral directive is permitted only within a macro. If we are
+handling the appropriate kind of literal text, nothing happens. Otherwise, the
+macro's input is skipped, either to .endinliteral or to the end of the macro.
+
+Argument: a single argument string
+Returns: nothing
+*/
+
+static void
+do_inliteral(uschar *p)
+{
+int state = -1;
+if (macrocurrent == NULL) { error(15, US".inliteral"); return; }
+if (Ustrcmp(p, "layout") == 0) state = LITERAL_LAYOUT;
+else if (Ustrcmp(p, "text") == 0) state = LITERAL_TEXT;
+else if (Ustrcmp(p, "off") == 0) state = LITERAL_OFF;
+else if (Ustrcmp(p, "xml") == 0) state = LITERAL_XML;
+else error(5, p);
+if (literal_state != state) skipto(US"inliteral", US".endinliteral");
+}
+
+
+
/*************************************************
* Handle .literal *
@@ -447,6 +503,23 @@ if (md->lines == NULL)
/*************************************************
+* Handle .nonl *
+*************************************************/
+
+/* Output the argument as normal text, but without a newline on the end.
+
+Argument: the rest of the line
+Returns: nothing
+*/
+
+static void
+do_nonl(uschar *p)
+{
+para_process(p);
+}
+
+
+/*************************************************
* Handle .pop *
*************************************************/
@@ -616,19 +689,22 @@ typedef struct dirstr {
static dirstr dirs[] = {
- { US".arg", 4, do_arg, TRUE, TRUE },
- { US".eacharg", 8, do_eacharg, TRUE, TRUE },
- { US".echo", 5, do_echo, TRUE, FALSE },
- { US".endarg", 7, do_endarg, FALSE, TRUE },
- { US".endeach", 8, do_endeach, TRUE, TRUE },
- { US".flag", 5, do_flag, FALSE, FALSE },
- { US".include", 8, do_include, TRUE, FALSE },
- { US".literal", 8, do_literal, TRUE, FALSE },
- { US".macro", 6, do_macro, FALSE, FALSE },
- { US".pop", 4, do_pop, TRUE, FALSE },
- { US".push", 5, do_push, FALSE, FALSE },
- { US".revision", 9, do_revision, TRUE, FALSE },
- { US".set", 4, do_set, FALSE, FALSE },
+ { US".arg", 4, do_arg, TRUE, TRUE },
+ { US".eacharg", 8, do_eacharg, TRUE, TRUE },
+ { US".echo", 5, do_echo, TRUE, FALSE },
+ { US".endarg", 7, do_endarg, FALSE, TRUE },
+ { US".endeach", 8, do_endeach, TRUE, TRUE },
+ { US".endinliteral", 13, do_endinliteral, FALSE, TRUE },
+ { US".flag", 5, do_flag, FALSE, FALSE },
+ { US".include", 8, do_include, TRUE, FALSE },
+ { US".inliteral", 10, do_inliteral, TRUE, TRUE },
+ { US".literal", 8, do_literal, TRUE, FALSE },
+ { US".macro", 6, do_macro, FALSE, FALSE },
+ { US".nonl", 5, do_nonl, TRUE, FALSE },
+ { US".pop", 4, do_pop, TRUE, FALSE },
+ { US".push", 5, do_push, FALSE, FALSE },
+ { US".revision", 9, do_revision, TRUE, FALSE },
+ { US".set", 4, do_set, FALSE, FALSE },
};
static int cmdcount = sizeof(dirs)/sizeof(dirstr);
diff --git a/src/error.c b/src/error.c
index 9c9a42549..3aa800742 100644
--- a/src/error.c
+++ b/src/error.c
@@ -48,7 +48,7 @@ static error_struct error_data[] = {
{ ec_serious, "missing semicolon after \"&%.*s\"" },
{ ec_serious, "unexpected character \"%c\" after \"&#\"" },
/* 5-9 */
-{ ec_serious, "\"layout\", \"text\", or \"off\" expected, but \"%s\" found" },
+{ ec_serious, "\"layout\", \"text\", \"xml\", or \"off\" expected, but \"%s\" found" },
{ ec_serious, "unknown flag \"&%c\"" },
{ ec_serious, "missing closing flag %s" },
{ ec_serious, "flag nesting error: \"%s\" expected before \"%s\"" },
diff --git a/src/globals.c b/src/globals.c
index 5082c105c..697335d9b 100644
--- a/src/globals.c
+++ b/src/globals.c
@@ -11,7 +11,7 @@
uschar *xfpt_share = US DATADIR;
-uschar *xfpt_version = US "0.01 22-Mar-2007";
+uschar *xfpt_version = US "0.02 05-Apr-2007";
tree_node *entities = NULL;
diff --git a/testing/infiles/01 b/testing/infiles/01
index 9dbf963b4..61d02eec8 100644
--- a/testing/infiles/01
+++ b/testing/infiles/01
@@ -20,9 +20,9 @@ We are going to have an index in the middle of a paragraph.
This is the rest of the paragraph.
.section "Second section"
-This is the text of the second section. Here's a reference to
+This is the text of the second section. Here's a reference to
chapter &<<CHAPsecond>>&. Here are some entities, both local and default:
-&&abcd; is &abcd;; &&rhubarb; is &rhubarb;.
+&&abcd; is &abcd;; &&amp is &amp;.
.chapter "Second chapter" "CHAPsecond"
This is the second chapter. Test a block quote:
@@ -31,7 +31,7 @@ This is the second chapter. Test a block quote:
.revision "changed"
.blockquote
-All the world's a stage, and all the men and women merely players. They have
+All the world's a stage, and all the men and women merely players. They have
their exits and their entrances, and one man in his time plays many parts.
.endblockquote
@@ -120,10 +120,10 @@ are touched
</para>
.literal off
-whereas this should &&&
+whereas this should &&&
note concats
-<and stuff>
-Test &copy; and &#1234; and &#x4dc4; for size.
+<and stuff>
+Test &copy; and &#1234; and &#x4dc4; for size.
Check `quote' marks. And ``doublequote'' marks.
@@ -131,7 +131,7 @@ This is a paragraph
where things happen over multiple
lines.
-Test some of the standard flags &'italic'& and &*bold*& text and
+Test some of the standard flags &'italic'& and &*bold*& text and
&`literal`& text and &_filename_& in text and &"quoted"& text and
we have && and &-- as single replacements.
@@ -181,13 +181,13 @@ There is no second argument.
.pqr
.pqr setarg1
-.pqr setarg1 setarg2
+.pqr setarg1 setarg2
-.literal text
+.code
Inside literal text, unknown directives
.like this one
should be passed as data
-.literal off
+.endd
.macro m1 one two
@@ -219,4 +219,95 @@ $+1
URL &url(http://etc) and another &url(http://etc, text) and so on.
+.new
+This is a paragraph marked new with .new/.wen.
+.wen
+
+.display
+The first line in a display.
+.new
+This line is between .new/.wen.
+.wen
+Another line.
+.endd
+
+.code
+The first line in a code section.
+.new
+This line is between .new/.wen.
+.wen
+Another line.
+.endd
+
+.include stdflags
+.include stdmacs
+
+.display
+A
+.new
+B
+.wen
+C
+.endd
+
+.display
+A
+.new "ZZZ"
+C
+.endd
+
+.code
+A
+.new
+B
+.wen
+C
+.endd
+
+.code
+A
+.new "ZZZ"
+C
+.endd
+
+.display
+A
+B &new(BB) BBB
+C
+.endd
+
+.code
+A
+B &new(BB) BBB
+C
+.endd
+
+.macro nesttest
+.arg 4
+FOUR "$1" "$2" "$3" "$4"
+.endarg
+.arg -4
+NOT FOUR
+.arg 3
+THREE "$1" "$2" "$3"
+.endarg
+.arg -3
+NOT THREE "$1" "$2"
+.endarg
+END NOT FOUR
+.endarg
+.endmacro
+
+.display
+.nesttest 1 2 3 4
+------------
+.nesttest 1 2 3
+------------
+.nesttest 1 2
+------------
+.nesttest 1
+------------
+.nesttest
+.endd
+
.makeindex
diff --git a/testing/infiles/02 b/testing/infiles/02
index b7c07d21d..b256fafc1 100644
--- a/testing/infiles/02
+++ b/testing/infiles/02
@@ -2,6 +2,7 @@
.include "stdmacs"
This input file tries to provoke errors &;.
+Non defined &&rhubarb is &rhubarb;
Try &&abcd without semicolon: &abcd and at EOL &abcd
.flag &:
diff --git a/testing/outfiles/01 b/testing/outfiles/01
index 6199c7225..3af3114e6 100644
--- a/testing/outfiles/01
+++ b/testing/outfiles/01
@@ -29,9 +29,9 @@ This is the rest of the paragraph.
<section>
<title>Second section</title>
<para>
-This is the text of the second section. Here&#x2019;s a reference to
+This is the text of the second section. Here&#x2019;s a reference to
chapter <xref linkend="CHAPsecond"/>. Here are some entities, both local and default:
-&amp;abcd; is ABCD; &amp;rhubarb; is &rhubarb;.
+&amp;abcd; is ABCD; &amp;amp is &amp;.
</para>
</section>
</chapter>
@@ -52,7 +52,7 @@ This is the second chapter. Test a block quote:
</para>
<blockquote revisionflag="changed">
<para revisionflag="changed">
-All the world&#x2019;s a stage, and all the men and women merely players. They have
+All the world&#x2019;s a stage, and all the men and women merely players. They have
their exits and their entrances, and one man in his time plays many parts.
</para>
</blockquote>
@@ -204,8 +204,8 @@ are touched
</para>
<para>
whereas this should note concats
-&lt;and stuff&gt;
-Test &copy; and &#1234; and &#x4dc4; for size.
+&lt;and stuff&gt;
+Test &copy; and &#1234; and &#x4dc4; for size.
</para>
<para>
Check &#x2018;quote&#x2019; marks. And &#x2018;&#x2018;doublequote&#x2019;&#x2019; marks.
@@ -216,7 +216,7 @@ where things happen over multiple
lines.
</para>
<para>
-Test some of the standard flags <emphasis>italic</emphasis> and <emphasis role="bold">bold</emphasis> text and
+Test some of the standard flags <emphasis>italic</emphasis> and <emphasis role="bold">bold</emphasis> text and
<literal>literal</literal> text and <filename>filename</filename> in text and <quote>quoted</quote> text and
we have &amp; and &ndash; as single replacements.
</para>
@@ -258,9 +258,11 @@ Always.
If arg1: setarg1
If arg2: setarg2
</para>
+<literallayout class="monospaced">
Inside literal text, unknown directives
.like this one
should be passed as data
+</literallayout>
<literallayout>
<literal>&amp;m1(1,2) </literal> |1 2|
<literal>&amp;m1(1) </literal> |1 two|
@@ -278,6 +280,69 @@ should be passed as data
<para>
URL <emphasis role="bold"><ulink url="http://etc">http://etc</ulink></emphasis> and another <emphasis role="bold"><ulink url="http://etc">text</ulink></emphasis> and so on.
</para>
+<para revisionflag="changed">
+This is a paragraph marked new with .new/.wen.
+</para>
+<literallayout>
+The first line in a display.
+<phrase revisionflag="changed">This line is between .new/.wen.
+</phrase>Another line.
+</literallayout>
+<literallayout class="monospaced">
+The first line in a code section.
+<phrase revisionflag="changed">This line is between .new/.wen.
+</phrase>Another line.
+</literallayout>
+<literallayout>
+A
+<phrase revisionflag="changed">B
+</phrase>C
+</literallayout>
+<literallayout>
+A
+<phrase revisionflag="changed">ZZZ</phrase>
+C
+</literallayout>
+<literallayout class="monospaced">
+A
+<phrase revisionflag="changed">B
+</phrase>C
+</literallayout>
+<literallayout class="monospaced">
+A
+&amp;&lt;phrase revisionflag="changed"&gt;&amp;ZZZ&amp;&lt;/phrase&gt;&amp;
+C
+</literallayout>
+<literallayout>
+A
+B <phrase revisionflag="changed">BB</phrase> BBB
+C
+</literallayout>
+<literallayout class="monospaced">
+A
+B &amp;new(BB) BBB
+C
+</literallayout>
+<literallayout>
+FOUR "1" "2" "3" "4"
+END NOT FOUR
+------------
+NOT FOUR
+THREE "1" "2" "3"
+END NOT FOUR
+------------
+NOT FOUR
+NOT THREE "1" "2"
+END NOT FOUR
+------------
+NOT FOUR
+NOT THREE "1" ""
+END NOT FOUR
+------------
+NOT FOUR
+NOT THREE "" ""
+END NOT FOUR
+</literallayout>
</chapter>
<index>
diff --git a/testing/outfiles/02 b/testing/outfiles/02
index a25d20ad5..ca864bfc3 100644
--- a/testing/outfiles/02
+++ b/testing/outfiles/02
@@ -1,5 +1,6 @@
<para>
This input file tries to provoke errors &amp;;.
+Non defined &amp;rhubarb is &rhubarb;
Try &amp;abcd without semicolon: &abcd and at EOL &abcd
</para>
<abcd>
diff --git a/testing/outfiles/02.err b/testing/outfiles/02.err
index 4ae503194..17746cb7b 100644
--- a/testing/outfiles/02.err
+++ b/testing/outfiles/02.err
@@ -1,88 +1,88 @@
** Error: unknown flag "&;"
- Detected near line 6 of infiles/02
+ Detected near line 7 of infiles/02
** Error: missing semicolon after "&abcd"
- Detected near line 6 of infiles/02
+ Detected near line 7 of infiles/02
** Error: missing semicolon after "&abcd"
- Detected near line 6 of infiles/02
+ Detected near line 7 of infiles/02
** Error: malformed directive
.flag &:
- Detected near line 7 of infiles/02
+ Detected near line 8 of infiles/02
** Error: malformed directive
.flag &: "abc" "xyz"
- Detected near line 8 of infiles/02
+ Detected near line 9 of infiles/02
** Error: a flag must begin with "&"
- Detected near line 9 of infiles/02
+ Detected near line 10 of infiles/02
** Error: malformed directive
.flag &: :& &'
- Detected near line 10 of infiles/02
+ Detected near line 11 of infiles/02
** Warning: extra characters at end of directive
.set abcd "abcd" xyz
^^^
- Detected near line 12 of infiles/02
+ Detected near line 13 of infiles/02
** Error: .arg is permitted only inside a macro
- Detected near line 14 of infiles/02
+ Detected near line 15 of infiles/02
** Error: .arg is permitted only inside a macro
- Detected near line 15 of infiles/02
+ Detected near line 16 of infiles/02
** Error: .endarg is permitted only inside a macro
- Detected near line 17 of infiles/02
+ Detected near line 18 of infiles/02
** Error: .endarg is permitted only inside a macro
- Detected near line 18 of infiles/02
+ Detected near line 19 of infiles/02
** Error: .eacharg is permitted only inside a macro
- Detected near line 20 of infiles/02
+ Detected near line 21 of infiles/02
** Error: .eacharg is permitted only inside a macro
- Detected near line 21 of infiles/02
+ Detected near line 22 of infiles/02
** Error: .endeach is permitted only inside a macro
- Detected near line 23 of infiles/02
+ Detected near line 24 of infiles/02
** Error: .endeach is permitted only inside a macro
- Detected near line 24 of infiles/02
+ Detected near line 25 of infiles/02
** Error: unknown directive line: .rhubarb and custard
- Detected near line 26 of infiles/02
+ Detected near line 27 of infiles/02
** Warning: extra characters at end of directive
.literal xml stuff
^^^^^
- Detected near line 28 of infiles/02
+ Detected near line 29 of infiles/02
** Warning: extra characters at end of directive
.literal off more stuff
^^^^^^^^^^
- Detected near line 30 of infiles/02
+ Detected near line 31 of infiles/02
** Error: malformed directive
.arg 4n
Processing macro x
- Detected near line 40 of infiles/02
+ Detected near line 41 of infiles/02
** Error: malformed directive
.arg
Processing macro x
- Detected near line 40 of infiles/02
+ Detected near line 41 of infiles/02
** Warning: extra characters at end of directive
.endarg 99
^^
Processing macro x
- Detected near line 40 of infiles/02
+ Detected near line 41 of infiles/02
** Warning: extra characters at end of directive
.eacharg 6 G
^
Processing macro x
- Detected near line 40 of infiles/02
+ Detected near line 41 of infiles/02