summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Hazel <ph10@hermes.cam.ac.uk>2009-07-24 15:28:45 +0000
committerNigel Metheringham <nigel@exim.org>2010-06-09 12:42:07 +0000
commitee3cabe6c57323f807ef50baf6341231801d0396 (patch)
tree797edbc08e7637ef64a256547fb1b21df4ae52ff
parent8c96bce3da514e576f4be2119eeb284c577f0f92 (diff)
downloadexim4-ee3cabe6c57323f807ef50baf6341231801d0396.tar.gz
Imported from /Users/nigel/Work/x/xfpt-0.07.tar.bz2.
-rw-r--r--doc/xfpt.html185
-rw-r--r--doc/xfpt.pdfbin62566 -> 64878 bytes
-rw-r--r--doc/xfpt.xfpt58
-rw-r--r--share/stdmacs50
-rw-r--r--src/globals.c4
-rw-r--r--testing/infiles/049
-rw-r--r--testing/outfiles/0416
-rwxr-xr-xtesting/runtest2
8 files changed, 229 insertions, 95 deletions
diff --git a/doc/xfpt.html b/doc/xfpt.html
index 062c0803e..b18242810 100644
--- a/doc/xfpt.html
+++ b/doc/xfpt.html
@@ -1,4 +1,3 @@
-<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><style xmlns="" type="text/css">
div.added { background-color: #ffff99; }
@@ -46,7 +45,7 @@ div[class=changed] div.literallayout {
</style>
<title>
The xfpt plain text to XML processor</title>
-<meta name="generator" content="DocBook XSL Stylesheets V1.70.1" />
+<meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
</head>
<body>
<div class="book" lang="en" xml:lang="en">
@@ -54,7 +53,7 @@ The xfpt plain text to XML processor</title>
<div>
<div>
<h1 class="title">
-<a id="id2490183">
+<a id="id2427425">
</a>
The xfpt plain text to XML processor</h1>
</div>
@@ -70,7 +69,7 @@ Hazel</span>
</div>
<div>
<p class="copyright">
-Copyright © 2008 University of Cambridge</p>
+Copyright © 2009 University of Cambridge</p>
</div>
<div>
<div class="revhistory">
@@ -83,9 +82,9 @@ Revision History</b>
</tr>
<tr>
<td align="left">
-Revision 0.06</td>
+Revision 0.07</td>
<td align="left">
-06 February 2008</td>
+22 July 2009</td>
<td align="left">
PH</td>
</tr>
@@ -389,92 +388,104 @@ directive</a>
</dt>
<dt>
<span xmlns="" class="section">
-<a id="toc0033" href="#ID32">
-4.2. Chapters, sections, and subsections</a>
+<a id="toc0033" href="#id2533921">
+4.2. Processing instructions</a>
</span>
</dt>
<dt>
<span xmlns="" class="section">
-<a id="toc0034" href="#ID33">
-4.3. Prefaces, appendixes, and colophons</a>
+<a id="toc0034" href="#ID32">
+4.3. Chapters, sections, and subsections</a>
</span>
</dt>
<dt>
<span xmlns="" class="section">
-<a id="toc0035" href="#ID34">
-4.4. URL references</a>
+<a id="toc0035" href="#ID33">
+4.4. Prefaces, appendixes, and colophons</a>
</span>
</dt>
<dt>
<span xmlns="" class="section">
-<a id="toc0036" href="#ID35">
-4.5. Itemized lists</a>
+<a id="toc0036" href="#id2534134">
+4.5. Terminating chapters, etc.</a>
</span>
</dt>
<dt>
<span xmlns="" class="section">
-<a id="toc0037" href="#ID36">
-4.6. Ordered lists</a>
+<a id="toc0037" href="#ID34">
+4.6. URL references</a>
</span>
</dt>
<dt>
<span xmlns="" class="section">
-<a id="toc0038" href="#ID37">
-4.7. Variable lists</a>
+<a id="toc0038" href="#ID35">
+4.7. Itemized lists</a>
</span>
</dt>
<dt>
<span xmlns="" class="section">
-<a id="toc0039" href="#ID38">
-4.8. Nested lists</a>
+<a id="toc0039" href="#ID36">
+4.8. Ordered lists</a>
</span>
</dt>
<dt>
<span xmlns="" class="section">
-<a id="toc0040" href="#ID39">
-4.9. Displayed text</a>
+<a id="toc0040" href="#ID37">
+4.9. Variable lists</a>
</span>
</dt>
<dt>
<span xmlns="" class="section">
-<a id="toc0041" href="#ID40">
-4.10. Block quotes</a>
+<a id="toc0041" href="#ID38">
+4.10. Nested lists</a>
</span>
</dt>
<dt>
<span xmlns="" class="section">
-<a id="toc0042" href="#SECTrevmacs">
-4.11. Revision markings</a>
+<a id="toc0042" href="#ID39">
+4.11. Displayed text</a>
</span>
</dt>
<dt>
<span xmlns="" class="section">
-<a id="toc0043" href="#ID42">
-4.12. Informal tables</a>
+<a id="toc0043" href="#ID40">
+4.12. Block quotes</a>
</span>
</dt>
<dt>
<span xmlns="" class="section">
-<a id="toc0044" href="#ID43">
-4.13. Formal tables</a>
+<a id="toc0044" href="#SECTrevmacs">
+4.13. Revision markings</a>
</span>
</dt>
<dt>
<span xmlns="" class="section">
-<a id="toc0045" href="#ID44">
-4.14. Figures and images</a>
+<a id="toc0045" href="#ID42">
+4.14. Informal tables</a>
</span>
</dt>
<dt>
<span xmlns="" class="section">
-<a id="toc0046" href="#ID45">
-4.15. Footnotes</a>
+<a id="toc0046" href="#ID43">
+4.15. Formal tables</a>
</span>
</dt>
<dt>
<span xmlns="" class="section">
-<a id="toc0047" href="#ID46">
-4.16. Indexes</a>
+<a id="toc0047" href="#ID44">
+4.16. Figures and images</a>
+</span>
+</dt>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0048" href="#ID45">
+4.17. Footnotes</a>
+</span>
+</dt>
+<dt>
+<span xmlns="" class="section">
+<a id="toc0049" href="#ID46">
+4.18. Indexes</a>
</span>
</dt>
</dl>
@@ -483,7 +494,7 @@ directive</a>
</div>
<div class="chapter" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a href="#" id="ID00">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>),
+forms of XML. Unlike <span class="emphasis"><em>AsciiDoc</em></span> (<span class="bold"><strong><a class="ulink" 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
freestanding ASCII document. The input for <span class="emphasis"><em>xfpt</em></span> is very definitely “<span class="quote">marked
up</span>”. This makes it less ambiguous for large and/or complicated documents. <span class="emphasis"><em>xfpt</em></span>
@@ -530,18 +541,18 @@ output, the appropriate XML entity reference (<code class="literal">&amp;amp;</c
 <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>
If no input is specified, the standard input is read. There are four options:
-</p><div class="variablelist"><dl><dt><span class="term"><span><strong class="option">-help</strong></span></span></dt><dd><p>
+</p><div class="variablelist"><dl><dt><span class="term"><span class="option"><strong>-help</strong></span></span></dt><dd><p>
This option causes <span class="emphasis"><em>xfpt</em></span> to output its “<span class="quote">usage</span>” message, and exit.
-</p></dd><dt><span class="term"><span><strong class="option">-o</strong></span> <span class="emphasis"><em>&lt;output destination&gt;</em></span></span></dt><dd><p>
+</p></dd><dt><span class="term"><span class="option"><strong>-o</strong></span> <span class="emphasis"><em>&lt;output destination&gt;</em></span></span></dt><dd><p>
This option overrides the default destination. If the standard input is being
read, the default destination is the standard output. Otherwise, the default
destination is the name of the input file with the extension <em class="filename">.xml</em>,
replacing its existing extension if there is one. A single hyphen character can
be given as an output destination to refer to the standard output.
-</p></dd><dt><span class="term"><span><strong class="option">-S</strong></span> <span class="emphasis"><em>&lt;directory path&gt;</em></span></span></dt><dd><p>
+</p></dd><dt><span class="term"><span class="option"><strong>-S</strong></span> <span class="emphasis"><em>&lt;directory path&gt;</em></span></span></dt><dd><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></dd><dt><span class="term"><span><strong class="option">-v</strong></span></span></dt><dd><p>
+</p></dd><dt><span class="term"><span class="option"><strong>-v</strong></span></span></dt><dd><p>
This option causes <span class="emphasis"><em>xfpt</em></span> to output its version number and exit.
</p></dd></dl></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="ID02">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:
@@ -570,7 +581,7 @@ standard macros and flags:
“<span class="quote">modes</span>”):
</p><div class="itemizedlist"><ul type="disc"><li><p>
In the default mode, text is processed paragraph by paragraph.
-<sup>[<a id="id2490955" href="#ftn.id2490955">1</a>]</sup>
+<sup>[<a id="id2481136" href="#ftn.id2481136" class="footnote">1</a>]</sup>
The end of a paragraph is indicated by the end of the input, a blank line, or
by an occurrence of the <span class="bold"><strong>.literal</strong></span> directive. Other directives (for example,
<span class="bold"><strong>.include</strong></span>) do not of themselves terminate a paragraph. Most of the standard
@@ -640,7 +651,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.11&#xA0;The .macro directive">3.11</a>. There are two ways of calling a macro. It can be called in the
+<a class="xref" 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>
@@ -674,10 +685,10 @@ 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 class="footnotes"><br /><hr width="100" align="left" /><div class="footnote"><p><sup>[<a id="ftn.id2490955" href="#id2490955">1</a>] </sup>
-<span xmlns="" class="changed"><span xmlns="http://www.w3.org/1999/xhtml">There is, however, a special case when a paragraph contains one or more
+</p></div><div class="footnotes"><br /><hr width="100" align="left" /><div class="footnote"><p><sup>[<a id="ftn.id2481136" href="#id2481136" class="para">1</a>] </sup>
+There is, however, a special case when a paragraph contains one or more
footnotes. In that situation, each part of the outer paragraph is processed
-independently.</span></span>
+independently.
</p></div></div></div><div class="chapter" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a href="#" id="ID06">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
@@ -718,7 +729,7 @@ without modification. For example:
</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="ID08">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.
+section <a class="xref" 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="ID09">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
@@ -786,7 +797,7 @@ 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="ID12">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 descriptions
-of the standard macros in chapter <a href="#CHAPstdmac" title="4.&#xA0;The standard macros for DocBook">4</a>.
+of the standard macros in chapter <a class="xref" 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="ID13">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
@@ -869,9 +880,9 @@ 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="ID20">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. <span xmlns="" class="changed"><span xmlns="http://www.w3.org/1999/xhtml">If
+library is prepended. Otherwise, the path is used unaltered. If
<span class="bold"><strong>.include</strong></span> is used inside a macro, it is evaluated each time the macro is
-called, and thus can be used to include a different file on each occasion.</span></span>
+called, and thus can be used to include a different file on each occasion.
</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="ID21">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
@@ -881,14 +892,14 @@ nested.
“<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
+Section <a class="xref" 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.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
macro. They are not processed in any way when the macro is defined; they are
-processed only when the macro is called (see section <a href="#SECTcallingmacro" title="1.5&#xA0;Calling macros">1.5</a>).
+processed only when the macro is called (see section <a class="xref" href="#SECTcallingmacro" title="1.5&#xA0;Calling macros">1.5</a>).
</p><p>
Within the body of a macro, argument substitutions can be specified by means of
a dollar character and an argument number, for example, <code class="literal">$3</code> for the third
@@ -951,7 +962,7 @@ remembered and <span class="emphasis"><em>xfpt</em></span> then reverts to the d
At the end of a nested sequence, if a paragraph has been started, it is
terminated, and then <span class="emphasis"><em>xfpt</em></span> reverts to the previous state.
</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="ID25">3.13 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 <span xmlns="" class="changed"><span xmlns="http://www.w3.org/1999/xhtml">an input line</span></span> without a newline at the end. This facility is useful
+as an input line 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="ID26">3.14 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
@@ -1009,7 +1020,7 @@ though it does still seem to process it correctly.
</p><p>
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.11&#xA0;Revision markings">4.11</a>).
+<a class="xref" href="#SECTrevmacs" title="4.13&#xA0;Revision markings">4.13</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="ID29">3.17 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
@@ -1042,7 +1053,18 @@ 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="ID32">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="id2533921">4.2 Processing instructions</a></h3></div></div></div><p>XML processing instructions such as <code class="literal">&lt;?sdop</code> <code class="literal">toc_sections="no"?&gt;</code> can, of
+course, be written written literally between <code class="literal">.literal</code> <code class="literal">xml</code> and
+<code class="literal">.literal</code> <code class="literal">off</code>. If there are a lot of them, this is perhaps the most
+convenient approach. A macro called <span class="bold"><strong>.pi</strong></span> is provided as an easy way of
+setting up a short processing instruction. Its first argument is the name of
+the processor for which the instruction is intended, and its second argument is
+the contents of the instruction, for example:
+</p><pre class="literallayout">
+ .pi sdop 'toc_sections="yes,yes,no"'
+</pre><p>
+This generates <code class="literal">&lt;?sdop</code> <code class="literal">toc_sections="yes,yes,no"?&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="ID32">4.3 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
@@ -1070,14 +1092,23 @@ argument can be an empty string. For example:
</pre><p>
Where and when the abbreviation is used in place of the full title is
controlled by the stylesheet when the XML is processed.
-</p><p>
-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="ID33">4.3 Prefaces, appendixes, and colophons</a></h3></div></div></div><p>The macros <span class="bold"><strong>.preface</strong></span>, <span class="bold"><strong>.appendix</strong></span>, and <span class="bold"><strong>.colophon</strong></span> operate in the same
+</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="ID33">4.4 Prefaces, appendixes, and colophons</a></h3></div></div></div><p>The macros <span class="bold"><strong>.preface</strong></span>, <span class="bold"><strong>.appendix</strong></span>, and <span class="bold"><strong>.colophon</strong></span> operate in the same
way as <span class="bold"><strong>.chapter</strong></span>, except that the first and the last have the default title
strings “<span class="quote">Preface</span>” and “<span class="quote">Colophon</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="ID34">4.4 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="id2534134">4.5 Terminating chapters, etc.</a></h3></div></div></div><p>The macros for chapters, sections, appendixes, etc. use the stack to ensure
+that each one is terminated at the correct point, without the need for an
+explicit terminator. For example, starting a new section automatically
+terminates an open subsection and a previous section.
+</p><p>
+Occasionally, however, there is a need to force an explicit termination. The
+<span class="bold"><strong>.endchapter</strong></span>, <span class="bold"><strong>.endsection</strong></span>, <span class="bold"><strong>.endsubsection</strong></span>, <span class="bold"><strong>.endpreface</strong></span>,
+<span class="bold"><strong>.endappendix</strong></span>, and <span class="bold"><strong>.endcolophon</strong></span> macros provide this facility. For
+example, if you want to include an XML processing instruction after a preface,
+but before the start of the following chapter, you must terminate the preface
+with <span class="bold"><strong>.endpreface</strong></span>. Otherwise a processing instruction that precedes the next
+<span class="bold"><strong>.chapter</strong></span> will end up inside the <code class="literal">&lt;preface&gt;</code> element. You should not
+include any actual text items at these points.
+</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="ID34">4.6 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:
@@ -1092,7 +1123,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="ID35">4.5 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="ID35">4.7 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
@@ -1111,7 +1142,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="ID36">4.6 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="ID36">4.8 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">
@@ -1132,7 +1163,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="ID37">4.7 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="ID37">4.9 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
@@ -1150,12 +1181,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="ID38">4.8 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="ID38">4.10 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="ID39">4.9 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="ID39">4.11 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.
@@ -1186,10 +1217,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="ID40">4.10 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="ID40">4.12 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.11 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.16&#xA0;The .revision directive">3.16</a>). When the revised text is
+</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.13 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 class="xref" href="#SECTrevision" title="3.16&#xA0;The .revision directive">3.16</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">
@@ -1239,7 +1270,7 @@ literal text mode.
If you want to add revision indications to part of a table, you must use an
inline call of <span class="bold"><strong>new</strong></span> within an argument of the <span class="bold"><strong>.row</strong></span> macro (see below).
This is the only usage that works 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="ID42">4.12 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></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="ID42">4.14 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.
@@ -1287,7 +1318,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="ID43">4.13 Formal tables</a></h3></div></div></div><p>The <span class="bold"><strong>.table</strong></span> macro starts a formal table, that is, a table that has a title,
+</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="ID43">4.15 Formal tables</a></h3></div></div></div><p>The <span class="bold"><strong>.table</strong></span> macro starts a formal table, that is, a table that has a title,
and which can be cross referenced. The first argument of this macro is the
table’s title; the second is an identifier for cross-referencing. If you are
not going to reference the table, an empty string must be supplied. From the
@@ -1298,22 +1329,22 @@ For example:
.row "cell 11" "cell 12"
.row "cell 21" "cell 22"
.endtable
-</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="ID44">4.14 Figures and images</a></h3></div></div></div><p>A figure is enclosed between <span class="bold"><strong>.figure</strong></span> and <span class="bold"><strong>.endfigure</strong></span> macros. The first
+</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="ID44">4.16 Figures and images</a></h3></div></div></div><p>A figure is enclosed between <span class="bold"><strong>.figure</strong></span> and <span class="bold"><strong>.endfigure</strong></span> macros. The first
argument of <span class="bold"><strong>.figure</strong></span> provides a title for the figure. The second is
optional; if present, it is a tag for references to the figure.
</p><p>
A figure normally contains an image. The <span class="bold"><strong>.image</strong></span> macro can be used in simple
cases. It generates a <code class="literal">&lt;mediaobject&gt;</code> element containing an
<code class="literal">&lt;imageobject&gt;</code>. The first argument is the name of the file containing the
-image. The remaining arguments are optional; <span xmlns="" class="changed"><span xmlns="http://www.w3.org/1999/xhtml">an empty string must be
+image. The remaining arguments are optional; an empty string must be
supplied as a placeholder when one that is not required is followed by one that
-is set.</span></span>
+is set.
</p><div class="itemizedlist"><ul type="disc"><li><p>
The second argument specifies a scaling factor for the image, as a percentage.
Thus, a value of 50 reduces the image to half size.
</p></li><li><p>
The third argument specifies an alignment for the image. It must be one of
-<code class="literal">left</code> <span xmlns="" class="changed"><span xmlns="http://www.w3.org/1999/xhtml">(default)</span></span>, <code class="literal">right</code> or <code class="literal">center</code> (or even <code class="literal">centre</code> if the
+<code class="literal">left</code> (default), <code class="literal">right</code> or <code class="literal">center</code> (or even <code class="literal">centre</code> if the
DocBook processor you are using can handle it).
</p></li><li><p>
The fourth and fifth arguments specify the depth and width, respectively. How
@@ -1331,7 +1362,7 @@ Here is another example, where the figure is reduced to 80% and centred:
.figure "A reduced figure"
.image figure02.eps 80 center
.endfigure
-</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="ID45">4.15 Footnotes</a></h3></div></div></div><p>Footnotes can be specified between <span class="bold"><strong>.footnote</strong></span> and <span class="bold"><strong>.endnote</strong></span> macros.
+</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="ID45">4.17 Footnotes</a></h3></div></div></div><p>Footnotes can be specified between <span class="bold"><strong>.footnote</strong></span> and <span class="bold"><strong>.endnote</strong></span> macros.
Within a footnote there can be any kind of text item, including displays and
tables. When a footnote occurs in the middle of a paragraph, paired flags
must not straddle the footnote. This example is wrong:
@@ -1349,7 +1380,7 @@ The correct markup for this example is:
That's really fast.
.endf
&amp;'brown'&amp; fox.
-</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="ID46">4.16 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
+</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="ID46">4.18 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 caa54eadf..2cda4081a 100644
--- a/doc/xfpt.pdf
+++ b/doc/xfpt.pdf
Binary files differ
diff --git a/doc/xfpt.xfpt b/doc/xfpt.xfpt
index e23ac9d67..093ccc330 100644
--- a/doc/xfpt.xfpt
+++ b/doc/xfpt.xfpt
@@ -13,14 +13,14 @@
<bookinfo>
<title>The xfpt plain text to XML processor</title>
<titleabbrev>xfpt</titleabbrev>
-<date>06 February 2008</date>
+<date>22 July 2009</date>
<author>
<firstname>Philip</firstname>
<surname>Hazel</surname>
</author>
<authorinitials>PH</authorinitials>
-<revhistory><revision><revnumber>0.06</revnumber><date>06 February 2008</date><authorinitials>PH</authorinitials></revision></revhistory>
-<copyright><year>2008</year><holder>University of Cambridge</holder></copyright>
+<revhistory><revision><revnumber>0.07</revnumber><date>22 July 2009</date><authorinitials>PH</authorinitials></revision></revhistory>
+<copyright><year>2009</year><holder>University of Cambridge</holder></copyright>
</bookinfo>
.literal off
@@ -152,9 +152,9 @@ standard macros and flags:
.ilist
In the default mode, text is processed paragraph by paragraph.
.footnote
-&new("There is, however, a special case when a paragraph contains one or more
+There is, however, a special case when a paragraph contains one or more
footnotes. In that situation, each part of the outer paragraph is processed
-independently.")
+independently.
.endnote
The end of a paragraph is indicated by the end of the input, a blank line, or
by an occurrence of the &*.literal*& directive. Other directives (for example,
@@ -374,6 +374,7 @@ you from generating invalid XML. For example, DocBook does not allow
&`<emphasis>`& within &`<literal>`&, though it does allow &`<literal>`& within
&`<emphasis>`&.
+
.section "Unrecognized flag sequences" ID10
If an ampersand is not followed by a character sequence in one of the forms
described in the preceding sections, an error occurs.
@@ -521,9 +522,9 @@ way to revert to the previous definition.
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 &X;
-library is prepended. Otherwise, the path is used unaltered. &new("If
+library is prepended. Otherwise, the path is used unaltered. If
&*.include*& is used inside a macro, it is evaluated each time the macro is
-called, and thus can be used to include a different file on each occasion.")
+called, and thus can be used to include a different file on each occasion.
.section "The &*.inliteral*& directive" ID21
@@ -619,7 +620,7 @@ terminated, and then &X; reverts to the previous state.
.section "The &*.nonl*& directive" ID25
This directive must be followed by a single string argument. It is processed
-as &new("an input line") without a newline at the end. This facility is useful
+as an input line 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.
@@ -731,6 +732,20 @@ The &*.book*& macro has no arguments. It generates &`<book>`& and pushes
&`</book>`& onto the stack so that it will be output at the end.
+.section "Processing instructions"
+XML processing instructions such as &`<?sdop`& &`toc_sections="no"?>`& can, of
+course, be written written literally between &`.literal`& &`xml`& and
+&`.literal`& &`off`&. If there are a lot of them, this is perhaps the most
+convenient approach. A macro called &*.pi*& is provided as an easy way of
+setting up a short processing instruction. Its first argument is the name of
+the processor for which the instruction is intended, and its second argument is
+the contents of the instruction, for example:
+.code
+ .pi sdop 'toc_sections="yes,yes,no"'
+.endd
+This generates &`<?sdop`& &`toc_sections="yes,yes,no"?>`&.
+
+
.section "Chapters, sections, and subsections" ID32
Chapters, sections, and subsections are supported by three macros that all
operate in the same way. They are &*.chapter*&, &*.section*&, and
@@ -761,10 +776,6 @@ argument can be an empty string. For example:
Where and when the abbreviation is used in place of the full title is
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.
-
.section "Prefaces, appendixes, and colophons" ID33
The macros &*.preface*&, &*.appendix*&, and &*.colophon*& operate in the same
@@ -772,6 +783,23 @@ way as &*.chapter*&, except that the first and the last have the default title
strings &"Preface"& and &"Colophon"&.
+.section "Terminating chapters, etc."
+The macros for chapters, sections, appendixes, etc. use the stack to ensure
+that each one is terminated at the correct point, without the need for an
+explicit terminator. For example, starting a new section automatically
+terminates an open subsection and a previous section.
+
+Occasionally, however, there is a need to force an explicit termination. The
+&*.endchapter*&, &*.endsection*&, &*.endsubsection*&, &*.endpreface*&,
+&*.endappendix*&, and &*.endcolophon*& macros provide this facility. For
+example, if you want to include an XML processing instruction after a preface,
+but before the start of the following chapter, you must terminate the preface
+with &*.endpreface*&. Otherwise a processing instruction that precedes the next
+&*.chapter*& will end up inside the &`<preface>`& element. You should not
+include any actual text items at these points.
+
+
+
.section "URL references" ID34
The &*url*& macro generates URL references, and is intended to be called inline
within the text that is being processed. It generates a &`<ulink>`& element,
@@ -1044,16 +1072,16 @@ optional; if present, it is a tag for references to the figure.
A figure normally contains an image. The &*.image*& macro can be used in simple
cases. It generates a &`<mediaobject>`& element containing an
&`<imageobject>`&. The first argument is the name of the file containing the
-image. The remaining arguments are optional; &new("an empty string must be
+image. The remaining arguments are optional; an empty string must be
supplied as a placeholder when one that is not required is followed by one that
-is set.")
+is set.
.ilist
The second argument specifies a scaling factor for the image, as a percentage.
Thus, a value of 50 reduces the image to half size.
.next
The third argument specifies an alignment for the image. It must be one of
-&`left`& &new("(default)"), &`right`& or &`center`& (or even &`centre`& if the
+&`left`& (default), &`right`& or &`center`& (or even &`centre`& if the
DocBook processor you are using can handle it).
.next
The fourth and fifth arguments specify the depth and width, respectively. How
diff --git a/share/stdmacs b/share/stdmacs
index 351d23fd7..967c0c206 100644
--- a/share/stdmacs
+++ b/share/stdmacs
@@ -30,6 +30,13 @@
.literal off
.endmacro
+.macro endpreface
+.literal layout
+.pop C
+.push C
+.literal off
+.endmacro
+
.macro chapter
.literal layout
.pop C
@@ -45,6 +52,13 @@
.literal off
.endmacro
+.macro endchapter
+.literal layout
+.pop C
+.push C
+.literal off
+.endmacro
+
.macro appendix
.literal layout
.pop C
@@ -60,6 +74,13 @@
.literal off
.endmacro
+.macro endappendix
+.literal layout
+.pop C
+.push C
+.literal off
+.endmacro
+
.macro colophon "Colophon"
.literal layout
.pop C
@@ -73,6 +94,13 @@
.literal off
.endmacro
+.macro endcolophon
+.literal layout
+.pop C
+.push C
+.literal off
+.endmacro
+
.macro section
.literal layout
.pop S
@@ -87,6 +115,13 @@
.literal off
.endmacro
+.macro endsection
+.literal layout
+.pop S
+.push S
+.literal off
+.endmacro
+
.macro subsection
.literal layout
.pop U
@@ -101,6 +136,13 @@
.literal off
.endmacro
+.macro endsubsection
+.literal layout
+.pop U
+.push U
+.literal off
+.endmacro
+
. =============== Lists ===============
.macro ilist
@@ -385,4 +427,12 @@
.literal off
.endmacro
+. =============== Processing instructions =============
+
+.macro pi
+.literal layout
+&<?$1 $2?>&
+.literal off
+.endmacro
+
. End
diff --git a/src/globals.c b/src/globals.c
index 44297f127..56d5a28fe 100644
--- a/src/globals.c
+++ b/src/globals.c
@@ -2,7 +2,7 @@
* xfpt - Simple ASCII->Docbook processor *
*************************************************/
-/* Copyright (c) University of Cambridge, 2008 */
+/* Copyright (c) University of Cambridge, 2009 */
/* Written by Philip Hazel. */
/* Allocate storage and initialize global variables */
@@ -11,7 +11,7 @@
uschar *xfpt_share = US DATADIR;
-uschar *xfpt_version = US "0.06 06-February-2008";
+uschar *xfpt_version = US "0.07 22-July-2009";
tree_node *entities = NULL;
diff --git a/testing/infiles/04 b/testing/infiles/04
new file mode 100644
index 000000000..917b2cac5
--- /dev/null
+++ b/testing/infiles/04
@@ -0,0 +1,9 @@
+.include stdflags
+.include stdmacs
+
+.preface "A first preface"
+This is text in the preface.
+.endpreface
+.pi sdop 'toc_sections="no"'
+.chapter "A first chapter"
+This is text in a chapter
diff --git a/testing/outfiles/04 b/testing/outfiles/04
new file mode 100644
index 000000000..5712bce99
--- /dev/null
+++ b/testing/outfiles/04
@@ -0,0 +1,16 @@
+<preface>
+<title>A first preface</title>
+<para>
+This is text in the preface.
+</para>
+</preface>
+
+<?sdop toc_sections="no"?>
+
+<chapter>
+<title>A first chapter</title>
+<para>
+This is text in a chapter
+</para>
+</chapter>
+
diff --git a/testing/runtest b/testing/runtest
index 1cd36a638..a125ce798 100755
--- a/testing/runtest
+++ b/testing/runtest
@@ -3,7 +3,7 @@
# Controlling script for xfpt tests
$xfpt = "../src/xfpt -S ../share";
-$cf = (-f "/usr/local/bin/cf")? "cf" : "diff -u";
+$cf = (-f "/usr/local/bin/cf")? "cf" : "diff";
$force_update = 0;
$starttest = undef;