Commits

Geoffrey Sneddon committed b1648aa

Rewrite ID gen algorithm in docs.

  • Participants
  • Parent commits f6b1efb
  • Tags 1.0RC3

Comments (0)

Files changed (2)

 </style>
 
 </head><body><header>
-	<h1>Anolis 1.0</h1>
-	<h2 class="no-num no-toc">Documentation — 29 September 2008</h2>
+    <h1>Anolis 1.0</h1>
+    <h2 class="no-num no-toc">Documentation — 29 November 2008</h2>
 </header>
 
 <h2 class="no-num no-toc" id=contents>Contents</h2>
 include niceties such as cross-references and a table of contents for the
 purpose of easy navigation — doing this manually can be a great chore
 especially when sections are numbered and a section is added, consequently
-changing the numbering of many others, leading to it being advantageous to do it
-programmatically.</p>
+changing the numbering of many others, leading to it being advantageous to do
+it programmatically.
 
-<p>Anolis does this on HTML documents, as a number of sequential processes.
+</p><p>Anolis does this on HTML documents, as a number of sequential processes.
 Currently cross-referencing, section numbering, table of contents creation, and
-a number of substitutions are done (mainly relating to the current
-date).</p>
+a number of substitutions are done (mainly relating to the current date).
 
-<h2 id=installing-anolis><span class=secno>2 </span>Installing Anolis</h2>
+</p><h2 id=installing-anolis><span class=secno>2 </span>Installing Anolis</h2>
 
 <h3 id=requirements><span class=secno>2.1 </span>Requirements</h3>
 
 <p>The following are the minimum requirements: later versions should also work
-without issue.</p>
+without issue.
 
-<ul>
-	<li><a href=http://python.org/>Python</a> 2.3
-	</li><li><a href=http://codespeak.net/lxml/>lxml</a> 2.0
-	</li><li><a href=http://code.google.com/p/html5lib>html5lib</a> 0.10
+</p><ul>
+    <li><a href=http://python.org/>Python</a> 2.3
+    </li><li><a href=http://codespeak.net/lxml/>lxml</a> 2.0
+    </li><li><a href=http://code.google.com/p/html5lib>html5lib</a> 0.10
 </li></ul>
 
 <h3 id=obtaining-a-copy><span class=secno>2.2 </span>Obtaining a copy</h3>
 
 <p>Releases are occasionally made. A link to the latest release can be found
-from the <a href=http://anolis.gsnedders.com>Anolis website</a>.</p>
+from the <a href=http://anolis.gsnedders.com>Anolis website</a>.
 
-<p>Alternatively, a copy can be obtained from <dfn id=our-mercurial-repository>our <a href=http://www.selenic.com/mercurial/>Mercurial</a> repository</dfn>: this is
-where our ongoing development occurs, and allows any revision (and therefore any
-release) to be downloaded. Our repository is located at
+</p><p>Alternatively, a copy can be obtained from <dfn id=our-mercurial-repository>our <a href=http://www.selenic.com/mercurial/>Mercurial</a> repository</dfn>: this
+is where our ongoing development occurs, and allows any revision (and therefore
+any release) to be downloaded. Our repository is located at
 <code><!--begin-link--><a href=http://hg.gsnedders.com/anolis/>http://hg.gsnedders.com/anolis/</a><!--end-link--></code>.
 
 </p><h3 id=installation><span class=secno>2.3 </span>Installation</h3>
 
-<p>Normally, installation is done through <a href=http://pypi.python.org/pypi/setuptools>setuptools</a>, with the following
-command:</p>
+<p>Normally, installation is done through <a href=http://pypi.python.org/pypi/setuptools>setuptools</a>, with the
+following command:
 
-<p><code>python setup.py install</code></p>
+</p><p><code>python setup.py install</code>
 
-<p>Please see setuptools' documentation for information on installation options
-(such as installing in non-standard locations).</p>
+</p><p>Please see setuptools' documentation for information on installation options
+(such as installing in non-standard locations).
 
-<h3 id=running-the-test-suite><span class=secno>2.4 </span>Running the test suite</h3>
+</p><h3 id=running-the-test-suite><span class=secno>2.4 </span>Running the test suite</h3>
 
-<p>The source distribution and the current development copy (in <a href=#our-mercurial-repository title="our
-mercurial repository">Mercurial</a>) both contain a test suite. It can be run
-with the following command:</p>
+<p>The source distribution and the current development copy (in <a href=#our-mercurial-repository title="our mercurial repository">Mercurial</a>) both contain a test suite.
+It can be run with the following command:
 
-<p><code>python runtests.py</code></p>
+</p><p><code>python runtests.py</code>
 
-<p>Any test failures should be reported at our <dfn id=bug-tracker><a href=http://bugs.gsnedders.com/projects/show/anolis>bug tracker</a></dfn>.</p>
+</p><p>Any test failures should be reported at our <dfn id=bug-tracker><a href=http://bugs.gsnedders.com/projects/show/anolis>bug
+tracker</a></dfn>.
 
-<h2 id=using-anolis><span class=secno>3 </span>Using Anolis</h2>
+</p><h2 id=using-anolis><span class=secno>3 </span>Using Anolis</h2>
 
 <p>Anolis is invoked through the <code>anolis</code> command. The
-<dfn id=help><code>--help</code></dfn> (or <dfn id=h><code>-h</code></dfn>) option gives some
-basic help.</p>
+<dfn id=help><code>--help</code></dfn> (or <dfn id=h><code>-h</code></dfn>) option gives
+some basic help.
 
-<p>The <dfn id=enable><code>--enable</code></dfn> and <dfn id=disable><code>--disable</code></dfn>
-options enable/disable respectively the process given as the option value (e.g.,
-<code>--disable=toc</code> disables building the <a href=#table-of-contents/section-numbering title="table of
+</p><p>The <dfn id=enable><code>--enable</code></dfn> and <dfn id=disable><code>--disable</code></dfn>
+options enable/disable respectively the process given as the option value
+(e.g., <code>--disable=toc</code> disables building the <a href=#table-of-contents/section-numbering title="table of
 contents/section numbering">table of contents and numbering sections</a>).
 The default processes are <code>sub</code> (<a href=#substitution>substitution</a>),
 <code>toc</code> (<a href=#table-of-contents/section-numbering>table of contents/section numbering</a>), and
 <code>xref</code> (<a href=#cross-referencing>cross-referencing</a>). Any enabled process loaded
 via <code>from processes import foo</code>, and if that fails <code>import
 foo</code> (where <code>foo</code> is the process), and is then called as
-<code>foo.foo(ElementTree, **kwargs)</code>.</p>
+<code>foo.foo(ElementTree, **kwargs)</code>.
 
-<p>Some options alter what is used to parse and serialize the document: by
+</p><p>Some options alter what is used to parse and serialize the document: by
 default, html5lib is used to parse the document; passing the
 <dfn id=lxml.html><code>--lxml.html</code></dfn> option uses libxml2's HTML parser and
 serializer instead (this is quicker, but does not comply to the <a href=http://whatwg.org/html5>HTML 5</a> standard, and sometimes results in a
 <a href=#fatal-error>fatal error</a>)<!--; passing the XXX: need double hyphen
-<dfn><code>xml</code></dfn> option uses libxml2's XML parser instead-->.</p>
+<dfn><code>xml</code></dfn> option uses libxml2's XML parser instead-->.
 
-<p>Anolis offers a <dfn id=compatibility-mode>compatibility mode</dfn>, which aims to be compatible
+</p><p>Anolis offers a <dfn id=compatibility-mode>compatibility mode</dfn>, which aims to be compatible
 with the <a href=http://www.w3.org/Style/Group/css3-src/bin/postprocess>CSS3
 module postprocessor</a> (within reason). This is mainly provided for the sake
 of pre-existing <a href=http://w3.org/>W3C</a> documents. The
 are also available (and are documented below under each <a href=#processes title=processes>process</a>) — these are all implied by the
 <a href=#w3c-compat><code>--w3c-compat</code></a> options, with one exception:
 <a href=#w3c-compat-crazy-substitutions><code>--w3c-compat-crazy-substitutions</code></a>, as it can lead to undesirable
-results.</p>
+results.
 
-<p>The options <dfn id=newline-char><code>--newline-char</code></dfn> and
+</p><p>The options <dfn id=newline-char><code>--newline-char</code></dfn> and
 <dfn id=indent-char><code>--indent-char</code></dfn> set the newline and indent strings (they
 do not have to be a single character) respecively. They default to U+000A LINE
 FEED (LF) and U+0020 SPACE respectively. These are only used when generating
-large trees of generated markup, such as the table of contents.</p>
+large trees of generated markup, such as the table of contents.
 
-<p>Other <a href=#processes title=processes>process</a> specific options are documented
-under the <a href=#processes title=processes>process</a> to which they belong.</p>
+</p><p>Other <a href=#processes title=processes>process</a> specific options are documented
+under the <a href=#processes title=processes>process</a> to which they belong.
 
-<p>Upon a <dfn id=fatal-error>fatal error</dfn>, processing of the document is terminated and
-the output file is left unchanged.</p>
+</p><p>Upon a <dfn id=fatal-error>fatal error</dfn>, processing of the document is terminated and
+the output file is left unchanged.
 
-<p>The <dfn id=textcontent>textContent</dfn> property is the same as that defined in <a href=http://w3.org/TR/DOM-Level-3-Core/>DOM Level 3 Core</a> on the Node
-interface.</p>
+</p><p>The <dfn id=textcontent>textContent</dfn> property is the same as that defined in <a href=http://w3.org/TR/DOM-Level-3-Core/>DOM Level 3 Core</a> on the Node
+interface.
 
-<p><dfn id=whitespace>Whitespace</dfn> is as defined in <a href=http://whatwg.org/html5>HTML
-5</a>: <q>U+0020 SPACE, U+0009 CHARACTER TABULATION (tab), U+000A LINE FEED
-(LF), U+000C FORM FEED (FF), and U+000D CARRIAGE RETURN (CR)</q>.</p>
+</p><p><dfn id=whitespace>Whitespace</dfn> is as defined in <a href=http://whatwg.org/html5>HTML 5</a>: <q>U+0020 SPACE, U+0009 CHARACTER
+TABULATION (tab), U+000A LINE FEED (LF), U+000C FORM FEED (FF), and U+000D
+CARRIAGE RETURN (CR)</q>.
 
-<p><dfn id=interactive-content>Interactive content</dfn> is as defined in
-<a href=http://whatwg.org/html5>HTML 5</a>: the <code>a</code>,
-<code>bb</code>, <code>details</code>, and <code>datagrid</code> elements; the
+</p><p><dfn id=interactive-content>Interactive content</dfn> is as defined in <a href=http://whatwg.org/html5>HTML 5</a>: the <code>a</code>, <code>bb</code>,
+<code>details</code>, and <code>datagrid</code> elements; the
 <code>audio</code> and <code>video</code> elements when they have a
 <code>controls</code> attribute; the <code>menu</code> element when the
 <code>type</code> attribute is case-insensitively equal to
-<code>toolbar</code>.</p>
+<code>toolbar</code>.
 
-<p><dfn id=id-generation title="id generation">When an <code>id</code> attribute is needed, it is
-created as follows</dfn>:
+</p><p><dfn id=id-generation title="id generation">When an <code>id</code> attribute is needed, it
+is created as follows</dfn>:
 
 </p><ol>
-	<li>If the element already has an <code>id</code> attribute, its value is
-used, and this algorithm stops; otherwise:
-	</li><li>If the <code>title</code> attribute is present and its value is not
+    <li>Let <var>i</var> be equal to 0.
+    </li><li>If the element already has an <code>id</code> attribute, return its
+value, and terminate this algorithm.
+    </li><li>If the <code>title</code> attribute is present and its value is not
 empty and does not consist of <a href=#whitespace>whitespace</a> only, let
 <var>generated_id</var> be equal to its value; otherwise, let
 <var>generated_id</var> be equal to <a href=#textcontent>textContent</a>.
-	</li><li>The <var>generated_id</var> is stripped of leading/trailing
+    </li><li>The <var>generated_id</var> is stripped of leading/trailing
 <a href=#whitespace>whitespace</a> and converted to lowercase (behaviour of this is
 dependent on the current locale setting of Python).
-	</li><li>The first of the following list whose condition matches the current
+    </li><li>The first of the following list whose condition matches the current
 state of the string is done:
-		<ol>
-			<li>If <var>generated_id</var> is an empty string,
+        <ol>
+            <li>If <var>generated_id</var> is an empty string,
 <var>generated_id</var> is set to <code>generatedID</code>.
-			</li><li>If the DOCTYPE's public identifier is one of <code>-//W3C//DTD
-HTML 4.0//EN</code>, <code>-//W3C//DTD HTML 4.0 Transitional//EN</code>,
-<code>-//W3C//DTD HTML 4.0 Frameset//EN</code>, <code>-//W3C//DTD HTML
-4.01//EN</code>, <code>-//W3C//DTD HTML 4.01 Transitional//EN</code>,
-<code>-//W3C//DTD HTML 4.01 Frameset//EN</code>, <code>ISO/IEC 15445:2000//DTD
-HyperText Markup Language//EN</code>, <code>ISO/IEC 15445:2000//DTD
-HTML//EN</code>, <code>-//W3C//DTD XHTML 1.0 Strict//EN</code>,
-<code>-//W3C//DTD XHTML 1.0 Transitional//EN</code>, <code>-//W3C//DTD XHTML 1.0
-Frameset//EN</code>, or <code>-//W3C//DTD XHTML 1.1//EN</code>; or the
-<dfn id=force-html4-id><code>--force-html4-id</code></dfn> option is used:
-				<ol>
-					<li>All runs of characters apart from U+002D HYPHEN-MINUS
+            </li><li>If the <dfn id=force-html4-id><code>--force-html4-id</code></dfn> option is used, or the DOCTYPE's public identifier is one of:
+                <ul>
+                    <li><code>-//W3C//DTD HTML 4.0//EN</code>
+                    </li><li><code>-//W3C//DTD HTML 4.0 Transitional//EN</code>
+                    </li><li><code>-//W3C//DTD HTML 4.0 Frameset//EN</code>
+                    </li><li><code>-//W3C//DTD HTML 4.01//EN</code>
+                    </li><li><code>-//W3C//DTD HTML 4.01 Transitional//EN</code>
+                    </li><li><code>-//W3C//DTD HTML 4.01 Frameset//EN</code>
+                    </li><li><code>ISO/IEC 15445:2000//DTD HyperText Markup
+                      Language//EN</code>
+                    </li><li><code>ISO/IEC 15445:2000//DTD HTML//EN</code>
+                    </li><li><code>-//W3C//DTD XHTML 1.0 Strict//EN</code>
+                    </li><li><code>-//W3C//DTD XHTML 1.0 Transitional//EN</code>
+                    </li><li><code>-//W3C//DTD XHTML 1.0 Frameset//EN</code>
+                    </li><li><code>-//W3C//DTD XHTML 1.1//EN</code>
+                </li></ul>
+              Then:
+                <ol>
+                    <li>All runs of characters apart from U+002D HYPHEN-MINUS
 (-), U+002E FULL STOP (.), U+0030 DIGIT ZERO to U+0039 DIGIT NINE (0–9),
-U+003A COLON (:), U+0041 LATIN CAPITAL LETTER A to U+005A LATIN CAPITAL LETTER Z
-(A–Z), U+005F LOW LINE (_), and U+0061 LATIN SMALL LETTER A to U+007A LATIN
+U+003A COLON (:), U+0041 LATIN CAPITAL LETTER A to U+005A LATIN CAPITAL LETTER
+Z (A–Z), U+005F LOW LINE (_), and U+0061 LATIN SMALL LETTER A to U+007A LATIN
 SMALL LETTER Z (a–z) are replaced by a single U+002D HYPHEN-MINUS (-)
 character within <var>generated_id</var>.
-					</li><li>Leading and trailing U+002D HYPHEN-MINUS (-) characters
+                    </li><li>Leading and trailing U+002D HYPHEN-MINUS (-) characters
 are removed from <var>generated_id</var>.
-					</li><li>If <var>generated_id</var> is not empty, if the first
-character is not in the range U+0041 LATIN CAPITAL LETTER A to U+005A LATIN
-CAPITAL LETTER Z (A–Z) or U+0061 LATIN SMALL LETTER A to U+007A LATIN SMALL
-LETTER Z (a–z), <var>generated_id</var> is prefixed by a single U+0078 LATIN
-SMALL LETTER X (x) character; otherwise, <var>generated_id</var> is set to
-<code>generatedID</code>.
-				</li></ol>
-			</li><li>Otherwise, runs of characters that do not match the ifragment
+                    </li><li>If <var>generated_id</var> is not empty and if the
+first character is not in the range U+0041 LATIN CAPITAL LETTER A to U+005A 
+LATIN CAPITAL LETTER Z (A–Z) or U+0061 LATIN SMALL LETTER A to U+007A LATIN 
+SMALL LETTER Z (a–z), <var>generated_id</var> is prefixed by a single U+0078 
+LATIN SMALL LETTER X (x) character.
+                </li></ol>
+            
+            </li><li>Otherwise, runs of characters that do not match the ifragment
 production in <a href=http://www.ietf.org/rfc/rfc3987>RFC 3987</a> are
 replaced by a single U+002D HYPHEN-MINUS (-) character within
 <var>generated_id</var>, and then leading and trailing U+002D HYPHEN-MINUS (-)
 characters are removed from <var>generated_id</var>.
-		</li></ol>
-	</li><li>If <var>generated_id</var> matches a ready-existing ID, continue to the
-next step; otherwise, jump to step 7.
-	</li><li>Increment <var>i</var> by one, or set it to one if it doesn't already
-exist.
-	</li><li>Go to step 4.
-	</li><li>The generated ID is <var>generated_id</var>.
+        </li></ol>
+    </li><li>If <var>generated_id</var> is empty, <var>generated_id</var> is set to <code>generatedID</code>.
+    </li><li>Let <var>output_id</var> equal <var>generated_id</var>.
+    </li><li>If <var>output_id</var> matches a ready-existing ID, continue to the
+next step; otherwise, jump to step 12.
+    </li><li>Increment <var>i</var> by one.
+    </li><li>Let <var>output_id</var> equal <var>generated_id</var> suffixed with a 
+U+002D HYPHEN-MINUS (-) character followed by <var>i</var> as a big-endian base 
+10 number.
+    </li><li>Jump back to step 8.
+    </li><li>The generated ID is <var>output_id</var>.
 </li></ol>
 
 <h2 id=processes><span class=secno>4 </span><dfn>Processes</dfn></h2>
 
 <p>The elements listed in the below processes, except where otherwise stated,
 are the local name of the element <!--either--> in null namespace<!-- or in the
-<dfn>HTML namespace</dfn> (<code>http://www.w3.org/1999/xhtml</code>)-->.</p>
+<dfn>HTML namespace</dfn> (<code>http://www.w3.org/1999/xhtml</code>)-->.
 
-<h3 id=cross-referencing><span class=secno>4.1 </span><dfn>Cross-referencing</dfn></h3>
+</p><h3 id=cross-referencing><span class=secno>4.1 </span><dfn>Cross-referencing</dfn></h3>
 
-<p>Cross-referencing has three essential parts:
-<dfn id=definition title=definition>definitions</dfn> that define
-<dfn id=term title=term>terms</dfn>, and <dfn id=instance title=instance>instances</dfn> of
-those <a href=#term title=term>terms</a>.</p>
+<p>Cross-referencing has three essential parts: <dfn id=definition title=definition>definitions</dfn> that define <dfn id=term title=term>terms</dfn>,
+and <dfn id=instance title=instance>instances</dfn> of those <a href=#term title=term>terms</a>.
 
-<p><a href=#definition title=definition>Definitions</a> are marked-up using the
+</p><p><a href=#definition title=definition>Definitions</a> are marked-up using the
 <code>dfn</code> element: the <a href=#definition>definition</a> itself is taken from the
 <code>title</code> attribute if it is present, otherwise it is taken from the
 <a href=#textcontent>textContent</a> property of the <code>dfn</code> element. By default,
 present in <a href=http://whatwg.org/html5>HTML 5</a>. Similar to <a href=#definition title=definition>definitions</a>, the <a href=#instance>instance</a> is taken from
 the <code>title</code> attribute if it is present, otherwise it is taken from
 the <a href=#textcontent>textContent</a> property. An <a href=#instance>instance</a> is only used if
-it does not have an <a href=#interactive-content>interactive content</a> or <code>dfn</code> element
-as either a parent or a child.</p>
+it does not have an <a href=#interactive-content>interactive content</a> or <code>dfn</code>
+element as either a parent or a child.
 
-<p>Both <a href=#definition title=definition>definitions</a> and <a href=#instance title=instance>instances</a> are <dfn id=cross-reference-normalization title="cross-reference
-normalization">normalized</dfn> as follows:</p>
+</p><p>Both <a href=#definition title=definition>definitions</a> and <a href=#instance title=instance>instances</a> are <dfn id=cross-reference-normalization title="cross-reference
+normalization">normalized</dfn> as follows:
 
-<ul>
-	<li>Leading and trailing <a href=#whitespace>whitespace</a> is stripped,
-	</li><li>Converted to lowercase (behaviour of this is dependent on the current
+</p><ul>
+    <li>Leading and trailing <a href=#whitespace>whitespace</a> is stripped,
+    </li><li>Converted to lowercase (behaviour of this is dependent on the current
 locale setting of Python),
-	</li><li>All consecutive <a href=#whitespace>whitespace</a> is replaced with a single U+0020
-SPACE CHARACTER<!-- unless there is a <code>pre</code> element as a parent-->,
-and
-	</li><li>If <dfn id=w3c-compat-xref-normalization><code>--w3c-compat-xref-normalization</code></dfn> is enabled,
+    </li><li>All consecutive <a href=#whitespace>whitespace</a> is replaced with a single
+U+0020 SPACE CHARACTER<!-- unless there is a <code>pre</code> element as a
+parent-->, and
+    </li><li>If <dfn id=w3c-compat-xref-normalization><code>--w3c-compat-xref-normalization</code></dfn> is enabled,
 all characters apart from U+0020 SPACE CHARACTER, U+002D HYPHEN-MINUS (-),
-U+0030 DIGIT ZERO to U+0039 DIGIT NINE (0–9), U+0041 LATIN CAPITAL LETTER A to
-U+005A LATIN CAPITAL LETTER Z (A–Z), and U+0061 LATIN SMALL LETTER A to U+007A
-LATIN SMALL LETTER Z (a–z) are removed.
+U+0030 DIGIT ZERO to U+0039 DIGIT NINE (0–9), U+0041 LATIN CAPITAL LETTER A
+to U+005A LATIN CAPITAL LETTER Z (A–Z), and U+0061 LATIN SMALL LETTER A to
+U+007A LATIN SMALL LETTER Z (a–z) are removed.
 </li></ul>
 
-<p>If the <a href=#instance>instance</a> is contained within a <code>span</code> element,
-the <code>span</code> element is turned into an <code>a</code> element, and a
-<code>href</code> attribute is added to link it to the <a href=#definition>definition</a>
-(e.g., <code>&lt;span&gt;foo&lt;/span&gt;</code> becomes <code>&lt;a
-href=#foo&gt;foo&lt;/a&gt;</code>) — all other attributes are preserved. Otherwise
-(when the <a href=#instance>instance</a> is not contained within a <code>span</code>
-element), the location of the <code>a</code> element when linking an
-<a href=#instance>instance</a> is dependent on the
+<p>If the <a href=#instance>instance</a> is contained within a <code>span</code>
+element, the <code>span</code> element is turned into an <code>a</code>
+element, and a <code>href</code> attribute is added to link it to the
+<a href=#definition>definition</a> (e.g., <code>&lt;span&gt;foo&lt;/span&gt;</code> becomes
+<code>&lt;a href=#foo&gt;foo&lt;/a&gt;</code>) — all other attributes are
+preserved. Otherwise (when the <a href=#instance>instance</a> is not contained within a
+<code>span</code> element), the location of the <code>a</code> element when
+linking an <a href=#instance>instance</a> is dependent on the
 <dfn id=w3c-compat-xref-a-placement><code>--w3c-compat-xref-a-placement</code></dfn> option: if it is disabled
 (the default), the <code>a</code> element is placed around the element
 containing the <a href=#instance>instance</a> (e.g., <code>&lt;i&gt;foo&lt;/i&gt;</code>
-becomes <code>&lt;a href=#foo&gt;&lt;i&gt;foo&lt;/i&gt;&lt;/a&gt;</code>); if it is enabled,
-the <code>a</code> element goes within the element containing the
+becomes <code>&lt;a href=#foo&gt;&lt;i&gt;foo&lt;/i&gt;&lt;/a&gt;</code>); if it is
+enabled, the <code>a</code> element goes within the element containing the
 <a href=#instance>instance</a> and goes around all of its content (e.g.,
 <code>&lt;i&gt;foo&lt;/i&gt;</code> becomes <code>&lt;i&gt;&lt;a
-href=#foo&gt;foo&lt;/a&gt;&lt;/i&gt;</code>).</p>
+href=#foo&gt;foo&lt;/a&gt;&lt;/i&gt;</code>).
 
-<h3 id=table-of-contents/section-numbering><span class=secno>4.2 </span><dfn>Table of contents/section numbering</dfn></h3>
+</p><h3 id=table-of-contents/section-numbering><span class=secno>4.2 </span><dfn>Table of contents/section numbering</dfn></h3>
 
 <p>To create a table of contents, and to number the <a href=#section title=section>sections</a> of the document, an <dfn id=outline>outline</dfn> is
-created (this is a list of <a href=#section title=section>sections</a>, which can each
-contain more <a href=#section title=section>sections</a>, where a <dfn id=section>section</dfn>
-represents a part of the document, and often has a <dfn id=section-heading title="section
-heading">heading</dfn> associated with it — for more detailed definitions see
-<a href=http://whatwg.org/html5>HTML 5</a>). This means not only are the
-<code>h1</code>–<code>h6</code> elements supported, but also elements such as
-<code title="">section</code> are used to create the <a href=#outline>outline</a>. After
-creating the
-<a href=#outline>outline</a>, every <a href=#section>section</a> with a depth between those
-provided by <dfn id=min-depth><code>--min-depth</code></dfn> and
-<dfn id=max-depth><code>--max-depth</code></dfn> (defaulting to two and six respectively),
-and which has a <a href=#section-heading title="section heading">heading</a>, is numbered if it
-does not have <code>no-num</code> as a class, and is added to the table of
-contents if it does not have <code>no-toc</code> as a class. <a href=#section title=section>Sections</a> without a <a href=#section-heading title="section
-heading">heading</a> are treated as if they did not exist, unless they have
-children, in which they will appear to exist while not existing all at once
-(e.g., they increment the <a href=#section>section</a> numbering, though that is not
-output anywhere; and they get a list item in the table of contents, with only
-the children within it, and no link to the <a href=#section>section</a> itself).</p>
+created (this is a list of <a href=#section title=section>sections</a>, which can
+each contain more <a href=#section title=section>sections</a>, where a
+<dfn id=section>section</dfn> represents a part of the document, and often has a <dfn id=section-heading title="section heading">heading</dfn> associated with it — for more detailed
+definitions see <a href=http://whatwg.org/html5>HTML 5</a>). This means not
+only are the <code>h1</code>–<code>h6</code> elements supported, but also
+elements such as <code title="">section</code> are used to create the
+<a href=#outline>outline</a>. After creating the <a href=#outline>outline</a>, every
+<a href=#section>section</a> with a depth between those provided by
+<dfn id=min-depth><code>--min-depth</code></dfn> and <dfn id=max-depth><code>--max-depth</code></dfn>
+(defaulting to two and six respectively), and which has a <a href=#section-heading title="section
+heading">heading</a>, is numbered if it does not have <code>no-num</code> as
+a class, and is added to the table of contents if it does not have
+<code>no-toc</code> as a class. <a href=#section title=section>Sections</a> without a
+<a href=#section-heading title="section heading">heading</a> are treated as if they did not
+exist, unless they have children, in which they will appear to exist while not
+existing all at once (e.g., they increment the <a href=#section>section</a> numbering,
+though that is not output anywhere; and they get a list item in the table of
+contents, with only the children within it, and no link to the
+<a href=#section>section</a> itself).
 
-<p>The format of <a href=#section>section</a> numbers should comply with <a href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=6937">ISO
+</p><p>The format of <a href=#section>section</a> numbers should comply with <a href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=6937">ISO
 2145:1978</a>, Numbering of divisions and subdivisions in written documents.
 This means that each <a href=#section>section</a> number is given by Arabic numerals,
 seperated by a single U+002E FULL STOP character, and there is no trailing
-U+002E FULL STOP character.</p>
+U+002E FULL STOP character.
 
-<p>The <a href=#section>section</a> number is inserted as the first child node of the
+</p><p>The <a href=#section>section</a> number is inserted as the first child node of the
 <a href=#section-heading>section heading</a> as a <code>span</code> element with the
 <code>class</code> attribute set to <code>secno</code>: this is copied into the
-table of contents.</p>
+table of contents.
 
-<p>Pre-existing <code>span</code> elements with a class of <code>secno</code>
+</p><p>Pre-existing <code>span</code> elements with a class of <code>secno</code>
 are removed from all <a href=#section-heading title="section heading">section headings</a>,
 regardless of whether their depth falls within the range given by
-<a href=#min-depth><code>--min-depth</code></a> and <a href=#max-depth><code>--max-depth</code></a>.</p>
+<a href=#min-depth><code>--min-depth</code></a> and <a href=#max-depth><code>--max-depth</code></a>.
 
-<p>The table of contents is built up as an ordered list (an <code>ol</code>
-element), with each <a href=#section>section</a> marked up as a <code>li</code> element,
-and child <a href=#section title=section>sections</a> are marked up with an
+</p><p>The table of contents is built up as an ordered list (an <code>ol</code>
+element), with each <a href=#section>section</a> marked up as a <code>li</code>
+element, and child <a href=#section title=section>sections</a> are marked up with an
 <code>ol</code> within that <code>li</code> (and this continues recursively, ad
 infinitum). By default, the root element of the table of contents (an
 <code>ol</code> element) is given a <code>class</code> attribute set to
 <code>ol</code> within the table of contents. The entire <a href=#section-heading>section
 heading</a> is copied to be the content of the list item, with all
 <a href=#interactive-content>interactive content</a> elements and <code>id</code> attributes
-removed.</p>
+removed.
 
-<p>A <a href=#normal-comment-substitution>normal comment substitution</a> is done with
+</p><p>A <a href=#normal-comment-substitution>normal comment substitution</a> is done with
 <var>sub_identifier</var> equal to <code>toc</code>, and the table of contents
-as the replacement.</p>
+as the replacement.
 
-<h3 id=substitution><span class=secno>4.3 </span><dfn>Substitution</dfn></h3>
+</p><h3 id=substitution><span class=secno>4.3 </span><dfn>Substitution</dfn></h3>
 
 <p>Various strings are replaced in magic ways: a <dfn id=normal-string-substitution>normal string
 substitution</dfn> takes the form of <code>[xxx]</code> where xxx is
 BRACKET character — these extra characters are effectively a comment, and
 carry absolutely no meaning, and vanish into some as-of-yet unknown abyss when
 the string replacement is done. The entire string must be contained within a
-single text node.</p>
+single text node.
 
-<p>A <dfn id=normal-comment-substitution>normal comment substitution</dfn> is one where there is a string,
-<var>sub_identifier</var>, that identifies the comment for the substitution, and
-the replacement. All nodes between a comment with a value equal to (with leading
-and trailing <a href=#whitespace>whitespace</a> removed) <code>begin-</code> followed by
-<var>sub_identifier</var> and one with q value equal to (with leading and
-trailing <a href=#whitespace>whitespace</a> removed) <code>end-</code> followed by
-<var>sub_identifier</var> are removed, and replaced with the replacement.
-Additionally, any comment (with leading and trailing <a href=#whitespace>whitespace</a>
-removed) with a value equal to <var>sub_identifier</var> is replaced with a
-comment with a value of <code>begin-</code> followed by
-<var>sub_identifier</var>, the replacement, and then a comment with a value of
-<code>end-</code> followed by <var>sub_identifier</var>.</p>
+</p><p>A <dfn id=normal-comment-substitution>normal comment substitution</dfn> is one where there is a string,
+<var>sub_identifier</var>, that identifies the comment for the substitution,
+and the replacement. All nodes between a comment with a value equal to (with
+leading and trailing <a href=#whitespace>whitespace</a> removed) <code>begin-</code>
+followed by <var>sub_identifier</var> and one with q value equal to (with
+leading and trailing <a href=#whitespace>whitespace</a> removed) <code>end-</code>
+followed by <var>sub_identifier</var> are removed, and replaced with the
+replacement. Additionally, any comment (with leading and trailing
+<a href=#whitespace>whitespace</a> removed) with a value equal to
+<var>sub_identifier</var> is replaced with a comment with a value of
+<code>begin-</code> followed by <var>sub_identifier</var>, the replacement, and
+then a comment with a value of <code>end-</code> followed by
+<var>sub_identifier</var>.
 
-<p>The <dfn id=w3c-status>W3C status</dfn> is found, when needed by one of the substitutions,
+</p><p>The <dfn id=w3c-status>W3C status</dfn> is found, when needed by one of the substitutions,
 by iterating all text nodes in document order (i.e., attribute values and
 comments have no effect), and for each node, the following is done (in this
-order):</p>
+order):
 
-<ol>
-	<li>If the node contains, case-insensitively, "latest", followed by one or
-more <a href=#whitespace>whitespace</a> characters, followed by "version", searching stops,
-and the default is used (ED).
-	</li><li>Otherwise, if the node, case-sensitively, contains
-"http://www.w3.org/TR/" followed by one of "MO", "WD", "CR", "PR", "REC", "PER",
-or "NOTE", which in turn is followed by U+002D HYPHEN-MINUS (-), then searching
-stops, and the status is whatever matched the previous list of options by the
-first match in the text node.
+</p><ol>
+    <li>If the node contains, case-insensitively, "latest", followed by one or
+more <a href=#whitespace>whitespace</a> characters, followed by "version", searching
+stops, and the default is used (ED).
+    </li><li>Otherwise, if the node, case-sensitively, contains
+"http://www.w3.org/TR/" followed by one of "MO", "WD", "CR", "PR", "REC",
+"PER", or "NOTE", which in turn is followed by U+002D HYPHEN-MINUS (-), then
+searching stops, and the status is whatever matched the previous list of
+options by the first match in the text node.
 </li></ol>
 
 <p>A side-effect of doing it in this order is the fact that if a node contains
 both of these possible strings is that the latter is ignored, meaning that the
-default (ED) is used.</p>
+default (ED) is used.
 
 <!-- I wish the above was more sane — it took me several hours to work out
-(though the comment in the CSS3 Module Postprocessor docs saying, "If there is a
-H2 subheading under the H1 that gives the spec's status, the [STATUS] variable
-will be initialized from that, otherwise it will default to WD." did not help me
-work it out quickly, as what is done is completely utterly different to that)
-— even though the algorithm is simple enough, it is just far too unexpected.
-Sadly, though, pre-existing documents depend on this very exact behaviour, and
-thus it cannot be changed. -->
+(though the comment in the CSS3 Module Postprocessor docs saying, "If there is
+a H2 subheading under the H1 that gives the spec's status, the [STATUS]
+variable will be initialized from that, otherwise it will default to WD." did
+not help me work it out quickly, as what is done is completely utterly
+different to that) — even though the algorithm is simple enough, it is just
+far too unexpected. Sadly, though, pre-existing documents depend on this very
+exact behaviour, and thus it cannot be changed. -->
 
-<p>There is also a <dfn id=long-w3c-status>long W3C status</dfn>, which correlates to the <a href=#w3c-status>W3C
-status</a> under the following mapping:</p>
+</p><p>There is also a <dfn id=long-w3c-status>long W3C status</dfn>, which correlates to the
+<a href=#w3c-status>W3C status</a> under the following mapping:
 
-<table>
-	<tbody><tr>
-		<th><a href=#w3c-status>W3C Status</a>
-		</th><th><a href=#long-w3c-status>Long W3C Status</a>
-	</th></tr><tr>
-		<td>MO
-		</td><td>W3C Member-only Draft
-	</td></tr><tr>
-		<td>ED
-		</td><td>Editor's Draft
-	</td></tr><tr>
-		<td>WD
-		</td><td>W3C Working Draft
-	</td></tr><tr>
-		<td>CR
-		</td><td>W3C Candidate Recommendation
-	</td></tr><tr>
-		<td>PR
-		</td><td>W3C Proposed Recommendation
-	</td></tr><tr>
-		<td>REC
-		</td><td>W3C Recommendation
-	</td></tr><tr>
-		<td>PER
-		</td><td>W3C Proposed Edited Recommendation
-	</td></tr><tr>
-		<td>NOTE
-		</td><td>W3C Working Group Note
+</p><table>
+    <tbody><tr>
+        <th><a href=#w3c-status>W3C Status</a>
+        </th><th><a href=#long-w3c-status>Long W3C Status</a>
+    </th></tr><tr>
+        <td>MO
+        </td><td>W3C Member-only Draft
+    </td></tr><tr>
+        <td>ED
+        </td><td>Editor's Draft
+    </td></tr><tr>
+        <td>WD
+        </td><td>W3C Working Draft
+    </td></tr><tr>
+        <td>CR
+        </td><td>W3C Candidate Recommendation
+    </td></tr><tr>
+        <td>PR
+        </td><td>W3C Proposed Recommendation
+    </td></tr><tr>
+        <td>REC
+        </td><td>W3C Recommendation
+    </td></tr><tr>
+        <td>PER
+        </td><td>W3C Proposed Edited Recommendation
+    </td></tr><tr>
+        <td>NOTE
+        </td><td>W3C Working Group Note
 </td></tr></tbody></table>
 
 <p>By default, the <a href=#normal-string-substitution title="normal string substitution">normal string
-substitutions</a> are:</p>
+substitutions</a> are:
 
-<dl>
-	<dt><code>[<!---->DATE]</code>
-	</dt><dd>This is replaced with the current date for UTC±0 in the form of, e.g.,
+</p><dl>
+    <dt><code>[<!---->DATE]</code>
+    </dt><dd>This is replaced with the current date for UTC±0 in the form of, e.g.,
 <samp>31 July 2008</samp>. The word used for the month is dependent on the
 current locale of Python. The number of the day of the month has no leading
 zeros.
-	</dd><dt><code>[<!---->CDATE]</code>
-	</dt><dd>This is replaced with the current date for UTC±0 in the form YYYYMMDD,
+    
+    </dd><dt><code>[<!---->CDATE]</code>
+    </dt><dd>This is replaced with the current date for UTC±0 in the form YYYYMMDD,
 e.g., <samp>20080731</samp>. This is a conforming <a href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=40874">ISO
 8601:2004</a> date.
-	</dd><dt><code>[<!---->YEAR]</code>
-	</dt><dd>This is replaced with the current year for UTC±0, in the form YYYY,
-e.g.,
-<samp>2008</samp>. This is a conforming <a href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=40874">ISO
+    
+    </dd><dt><code>[<!---->YEAR]</code>
+    </dt><dd>This is replaced with the current year for UTC±0, in the form YYYY,
+e.g., <samp>2008</samp>. This is a conforming <a href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=40874">ISO
 8601:2004</a> year.
-	</dd><dt><code>[<!---->TITLE]</code>
-	</dt><dd>This is replaced with the <a href=#textcontent>textContent</a> of the first
+    
+    </dd><dt><code>[<!---->TITLE]</code>
+    </dt><dd>This is replaced with the <a href=#textcontent>textContent</a> of the first
 <code>title</code> element which is within the first <code>head</code> of the
 document, or an empty string if such a <code>title</code> element does not
 exist.
 <code>a</code> element which has a <code>href</code> attribute equal to the
 <a href=#textcontent><code>textContent</code></a> of all the nodes between the two comments concatenated
 in document order. The two comments must have the same parent, otherwise a
-<a href=#fatal-error>fatal error</a> occurs.</p>
+<a href=#fatal-error>fatal error</a> occurs.
 
-<p>If <dfn id=w3c-compat-substitutions><code>--w3c-compat-substitutions</code></dfn> is enabled, the
+</p><p>If <dfn id=w3c-compat-substitutions><code>--w3c-compat-substitutions</code></dfn> is enabled, the
 following <a href=#normal-string-substitution title="normal string substitution">normal string
-substitutions</a> are done in addition to those above:</p>
+substitutions</a> are done in addition to those above:
 
-<dl>
-	<dt><code>[STATUS]</code>
-	</dt><dd>This is replaced with the <a href=#w3c-status>W3C status</a>.
-	</dd><dt><code>[LONGSTATUS]</code>
-	</dt><dd>This is replaced with the <a href=#long-w3c-status>long W3C status</a>.
+</p><dl>
+    <dt><code>[STATUS]</code>
+    </dt><dd>This is replaced with the <a href=#w3c-status>W3C status</a>.
+    
+    </dd><dt><code>[LONGSTATUS]</code>
+    </dt><dd>This is replaced with the <a href=#long-w3c-status>long W3C status</a>.
 </dd></dl>
 
 <p>Additionally, the following <a href=#normal-comment-substitution title="normal comment substitution">normal
-comment substitutions</a> are done:</p>
+comment substitutions</a> are done:
 
-<dl>
-	<dt><var>sub_identifier</var> equal to <code>logo</code>
-	</dt><dd>Replacement is equal to: <code>&lt;p&gt;&lt;a
+</p><dl>
+    <dt><var>sub_identifier</var> equal to <code>logo</code>
+    </dt><dd>Replacement is equal to: <code>&lt;p&gt;&lt;a
 href="http://www.w3.org/"&gt;&lt;img alt="W3C"
 src="http://www.w3.org/Icons/w3c_home"/&gt;&lt;/a&gt;&lt;/p&gt;</code> (parsed as an XML
 fragment, and serialized into the output document in the needed format).
-	
-	</dd><dt><var>sub_identifier</var> equal to <code>copyright</code>
-	</dt><dd>Replacement is equal to: <code>&lt;p class="copyright"&gt;&lt;a
+    
+    </dd><dt><var>sub_identifier</var> equal to <code>copyright</code> 
+    </dt><dd>Replacement is equal to: <code>&lt;p class="copyright"&gt;&lt;a
 href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright"&gt;Copyright&lt;/a&gt;
 © [<!---->YEAR] &lt;a href="http://www.w3.org/"&gt;&lt;acronym title="World
 Wide Web Consortium"&gt;W3C&lt;/acronym&gt;&lt;/a&gt;&lt;sup&gt;®&lt;/sup&gt; (&lt;a
 href="http://www.csail.mit.edu/"&gt;&lt;acronym title="Massachusetts Institute of
 Technology"&gt;MIT&lt;/acronym&gt;&lt;/a&gt;, &lt;a
-href="http://www.ercim.org/"&gt;&lt;acronym title="European Research Consortium for
-Informatics and Mathematics"&gt;ERCIM&lt;/acronym&gt;&lt;/a&gt;, &lt;a
+href="http://www.ercim.org/"&gt;&lt;acronym title="European Research Consortium
+for Informatics and Mathematics"&gt;ERCIM&lt;/acronym&gt;&lt;/a&gt;, &lt;a
 href="http://www.keio.ac.jp/"&gt;Keio&lt;/a&gt;), All Rights Reserved. W3C &lt;a
 href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer"&gt;liability&lt;/a&gt;,
 &lt;a
 href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks"&gt;trademark&lt;/a&gt;
-and &lt;a href="http://www.w3.org/Consortium/Legal/copyright-documents"&gt;document
-use&lt;/a&gt; rules apply.&lt;/p&gt;</code> (parsed as an XML fragment, and serialized
-into the output document in the needed format).
+and &lt;a
+href="http://www.w3.org/Consortium/Legal/copyright-documents"&gt;document
+use&lt;/a&gt; rules apply.&lt;/p&gt;</code> (parsed as an XML fragment, and
+serialized into the output document in the needed format).
 </dd></dl>
 
 <p>There is one further string substitution, and this is only done when
 <code>http://www.w3.org/StyleSheets/TR/W3C-</code> followed by one or more
 characters in the range U+0041 LATIN CAPITAL LETTER A to U+005A LATIN CAPITAL
 LETTER Z (A–Z) is replaced with whatever
-<code>http://www.w3.org/StyleSheets/TR/W3C-[STATUS]</code> would evaluate to be.
-Like the <a href=#normal-string-substitution title="normal string substitution">normal string
-substitutions</a>, this string must be contained in a single text node.</p>
+<code>http://www.w3.org/StyleSheets/TR/W3C-[STATUS]</code> would evaluate to
+be. Like the <a href=#normal-string-substitution title="normal string substitution">normal string
+substitutions</a>, this string must be contained in a single text node.
 
 <!-- Is that crazy enough to justify the option name? -->
 
-<h2 class=no-num id=acknowledgements>Acknowledgements</h2>
+</p><h2 class=no-num id=acknowledgements>Acknowledgements</h2>
 
 <p>Thanks to Andrew Sidwell, Anne van Kesteren, Henri Sivonen, Ian Hickson,
 James Graham, Lachlan Hunt, Magnus Kristiansen, Michael(tm) Smith, and Philip
-Taylor for their ever needed help.</p>
+Taylor for their ever needed help.
 
-<p>Special thanks to Bert Bos for creating the CSS3 Module Postprocessor, on
-which this is partially based, and (with <a href=#w3c-compat><code>--w3c-compat</code></a>) claims to be
-partially compatible with. Further special thanks to Bert Bos for creating a
+</p><p>Special thanks to Bert Bos for creating the CSS3 Module Postprocessor, on
+which this is partially based, and (with <a href=#w3c-compat><code>--w3c-compat</code></a>) claims to
+be partially compatible with. Further special thanks to Bert Bos for creating a
 number of things (especially the algorithm for finding the <a href=#w3c-status>W3C
 status</a>) that took the author of Anolis many hours to reverse
-engineer.</p>
-</body></html>
+engineer.
+</p></body></html>

File README.src.html

 </style>
 
 <header>
-	<h1>[TITLE]</h1>
-	<h2 class="no-num no-toc">Documentation — [DATE]</h2>
+    <h1>[TITLE]</h1>
+    <h2 class="no-num no-toc">Documentation — [DATE]</h2>
 </header>
 
 <h2 class="no-num no-toc">Contents</h2>
 include niceties such as cross-references and a table of contents for the
 purpose of easy navigation — doing this manually can be a great chore
 especially when sections are numbered and a section is added, consequently
-changing the numbering of many others, leading to it being advantageous to do it
-programmatically.</p>
+changing the numbering of many others, leading to it being advantageous to do
+it programmatically.
 
 <p>Anolis does this on HTML documents, as a number of sequential processes.
 Currently cross-referencing, section numbering, table of contents creation, and
-a number of substitutions are done (mainly relating to the current
-date).</p>
+a number of substitutions are done (mainly relating to the current date).
 
 <h2>Installing Anolis</h2>
 
 <h3>Requirements</h3>
 
 <p>The following are the minimum requirements: later versions should also work
-without issue.</p>
+without issue.
 
 <ul>
-	<li><a href="http://python.org/">Python</a> 2.3
-	<li><a href="http://codespeak.net/lxml/">lxml</a> 2.0
-	<li><a href="http://code.google.com/p/html5lib">html5lib</a> 0.10
+    <li><a href="http://python.org/">Python</a> 2.3
+    <li><a href="http://codespeak.net/lxml/">lxml</a> 2.0
+    <li><a href="http://code.google.com/p/html5lib">html5lib</a> 0.10
 </ul>
 
 <h3>Obtaining a copy</h3>
 
 <p>Releases are occasionally made. A link to the latest release can be found
-from the <a href="http://anolis.gsnedders.com">Anolis website</a>.</p>
+from the <a href="http://anolis.gsnedders.com">Anolis website</a>.
 
 <p>Alternatively, a copy can be obtained from <dfn>our <a
-href="http://www.selenic.com/mercurial/">Mercurial</a> repository</dfn>: this is
-where our ongoing development occurs, and allows any revision (and therefore any
-release) to be downloaded. Our repository is located at
+href="http://www.selenic.com/mercurial/">Mercurial</a> repository</dfn>: this
+is where our ongoing development occurs, and allows any revision (and therefore
+any release) to be downloaded. Our repository is located at
 <code><!--begin-link-->http://hg.gsnedders.com/anolis/<!--end-link--></code>.
 
 <h3>Installation</h3>
 
 <p>Normally, installation is done through <a
-href="http://pypi.python.org/pypi/setuptools">setuptools</a>, with the following
-command:</p>
+href="http://pypi.python.org/pypi/setuptools">setuptools</a>, with the
+following command:
 
-<p><code>python setup.py install</code></p>
+<p><code>python setup.py install</code>
 
 <p>Please see setuptools' documentation for information on installation options
-(such as installing in non-standard locations).</p>
+(such as installing in non-standard locations).
 
 <h3>Running the test suite</h3>
 
-<p>The source distribution and the current development copy (in <span title="our
-mercurial repository">Mercurial</span>) both contain a test suite. It can be run
-with the following command:</p>
+<p>The source distribution and the current development copy (in <span
+title="our mercurial repository">Mercurial</span>) both contain a test suite.
+It can be run with the following command:
 
-<p><code>python runtests.py</code></p>
+<p><code>python runtests.py</code>
 
 <p>Any test failures should be reported at our <dfn><a
-href="http://bugs.gsnedders.com/projects/show/anolis">bug tracker</a></dfn>.</p>
+href="http://bugs.gsnedders.com/projects/show/anolis">bug
+tracker</a></dfn>.
 
 <h2>Using Anolis</h2>
 
 <p>Anolis is invoked through the <code>anolis</code> command. The
-<dfn><code>--help</code></dfn> (or <dfn><code>-h</code></dfn>) option gives some
-basic help.</p>
+<dfn><code>--help</code></dfn> (or <dfn><code>-h</code></dfn>) option gives
+some basic help.
 
 <p>The <dfn><code>--enable</code></dfn> and <dfn><code>--disable</code></dfn>
-options enable/disable respectively the process given as the option value (e.g.,
-<code>--disable=toc</code> disables building the <span title="table of
+options enable/disable respectively the process given as the option value
+(e.g., <code>--disable=toc</code> disables building the <span title="table of
 contents/section numbering">table of contents and numbering sections</span>).
 The default processes are <code>sub</code> (<span>substitution</span>),
 <code>toc</code> (<span>table of contents/section numbering</span>), and
 <code>xref</code> (<span>cross-referencing</span>). Any enabled process loaded
 via <code>from processes import foo</code>, and if that fails <code>import
 foo</code> (where <code>foo</code> is the process), and is then called as
-<code>foo.foo(ElementTree, **kwargs)</code>.</p>
+<code>foo.foo(ElementTree, **kwargs)</code>.
 
 <p>Some options alter what is used to parse and serialize the document: by
 default, html5lib is used to parse the document; passing the
 serializer instead (this is quicker, but does not comply to the <a
 href="http://whatwg.org/html5">HTML 5</a> standard, and sometimes results in a
 <span>fatal error</span>)<!--; passing the XXX: need double hyphen
-<dfn><code>xml</code></dfn> option uses libxml2's XML parser instead-->.</p>
+<dfn><code>xml</code></dfn> option uses libxml2's XML parser instead-->.
 
 <p>Anolis offers a <dfn>compatibility mode</dfn>, which aims to be compatible
 with the <a href="http://www.w3.org/Style/Group/css3-src/bin/postprocess">CSS3
 title="processes">process</span>) — these are all implied by the
 <code>--w3c-compat</code> options, with one exception:
 <code>--w3c-compat-crazy-substitutions</code>, as it can lead to undesirable
-results.</p>
+results.
 
 <p>The options <dfn><code>--newline-char</code></dfn> and
 <dfn><code>--indent-char</code></dfn> set the newline and indent strings (they
 do not have to be a single character) respecively. They default to U+000A LINE
 FEED (LF) and U+0020 SPACE respectively. These are only used when generating
-large trees of generated markup, such as the table of contents.</p>
+large trees of generated markup, such as the table of contents.
 
 <p>Other <span title="processes">process</span> specific options are documented
-under the <span title="processes">process</span> to which they belong.</p>
+under the <span title="processes">process</span> to which they belong.
 
 <p>Upon a <dfn>fatal error</dfn>, processing of the document is terminated and
-the output file is left unchanged.</p>
+the output file is left unchanged.
 
 <p>The <dfn>textContent</dfn> property is the same as that defined in <a
 href="http://w3.org/TR/DOM-Level-3-Core/">DOM Level 3 Core</a> on the Node
-interface.</p>
+interface.
 
-<p><dfn>Whitespace</dfn> is as defined in <a href="http://whatwg.org/html5">HTML
-5</a>: <q>U+0020 SPACE, U+0009 CHARACTER TABULATION (tab), U+000A LINE FEED
-(LF), U+000C FORM FEED (FF), and U+000D CARRIAGE RETURN (CR)</q>.</p>
+<p><dfn>Whitespace</dfn> is as defined in <a
+href="http://whatwg.org/html5">HTML 5</a>: <q>U+0020 SPACE, U+0009 CHARACTER
+TABULATION (tab), U+000A LINE FEED (LF), U+000C FORM FEED (FF), and U+000D
+CARRIAGE RETURN (CR)</q>.
 
-<p><dfn>Interactive content</dfn> is as defined in
-<a href="http://whatwg.org/html5">HTML 5</a>: the <code>a</code>,
-<code>bb</code>, <code>details</code>, and <code>datagrid</code> elements; the
+<p><dfn>Interactive content</dfn> is as defined in <a
+href="http://whatwg.org/html5">HTML 5</a>: the <code>a</code>, <code>bb</code>,
+<code>details</code>, and <code>datagrid</code> elements; the
 <code>audio</code> and <code>video</code> elements when they have a
 <code>controls</code> attribute; the <code>menu</code> element when the
 <code>type</code> attribute is case-insensitively equal to
-<code>toolbar</code>.</p>
+<code>toolbar</code>.
 
-<p><dfn title="id generation">When an <code>id</code> attribute is needed, it is
-created as follows</dfn>:
+<p><dfn title="id generation">When an <code>id</code> attribute is needed, it
+is created as follows</dfn>:
 
 <ol>
-	<li>If the element already has an <code>id</code> attribute, its value is
-used, and this algorithm stops; otherwise:
-	<li>If the <code>title</code> attribute is present and its value is not
+    <li>Let <var>i</var> be equal to 0.
+    <li>If the element already has an <code>id</code> attribute, return its
+value, and terminate this algorithm.
+    <li>If the <code>title</code> attribute is present and its value is not
 empty and does not consist of <span>whitespace</span> only, let
 <var>generated_id</var> be equal to its value; otherwise, let
 <var>generated_id</var> be equal to <span>textContent</span>.
-	<li>The <var>generated_id</var> is stripped of leading/trailing
+    <li>The <var>generated_id</var> is stripped of leading/trailing
 <span>whitespace</span> and converted to lowercase (behaviour of this is
 dependent on the current locale setting of Python).
-	<li>The first of the following list whose condition matches the current
+    <li>The first of the following list whose condition matches the current
 state of the string is done:
-		<ol>
-			<li>If <var>generated_id</var> is an empty string,
+        <ol>
+            <li>If <var>generated_id</var> is an empty string,
 <var>generated_id</var> is set to <code>generatedID</code>.
-			<li>If the DOCTYPE's public identifier is one of <code>-//W3C//DTD
-HTML 4.0//EN</code>, <code>-//W3C//DTD HTML 4.0 Transitional//EN</code>,
-<code>-//W3C//DTD HTML 4.0 Frameset//EN</code>, <code>-//W3C//DTD HTML
-4.01//EN</code>, <code>-//W3C//DTD HTML 4.01 Transitional//EN</code>,
-<code>-//W3C//DTD HTML 4.01 Frameset//EN</code>, <code>ISO/IEC 15445:2000//DTD
-HyperText Markup Language//EN</code>, <code>ISO/IEC 15445:2000//DTD
-HTML//EN</code>, <code>-//W3C//DTD XHTML 1.0 Strict//EN</code>,
-<code>-//W3C//DTD XHTML 1.0 Transitional//EN</code>, <code>-//W3C//DTD XHTML 1.0
-Frameset//EN</code>, or <code>-//W3C//DTD XHTML 1.1//EN</code>; or the
-<dfn><code>--force-html4-id</code></dfn> option is used:
-				<ol>
-					<li>All runs of characters apart from U+002D HYPHEN-MINUS
+            <li>If the <dfn><code>--force-html4-id</code></dfn> option is used, or the DOCTYPE's public identifier is one of:
+                <ul>
+                    <li><code>-//W3C//DTD HTML 4.0//EN</code>
+                    <li><code>-//W3C//DTD HTML 4.0 Transitional//EN</code>
+                    <li><code>-//W3C//DTD HTML 4.0 Frameset//EN</code>
+                    <li><code>-//W3C//DTD HTML 4.01//EN</code>
+                    <li><code>-//W3C//DTD HTML 4.01 Transitional//EN</code>
+                    <li><code>-//W3C//DTD HTML 4.01 Frameset//EN</code>
+                    <li><code>ISO/IEC 15445:2000//DTD HyperText Markup
+                      Language//EN</code>
+                    <li><code>ISO/IEC 15445:2000//DTD HTML//EN</code>
+                    <li><code>-//W3C//DTD XHTML 1.0 Strict//EN</code>
+                    <li><code>-//W3C//DTD XHTML 1.0 Transitional//EN</code>
+                    <li><code>-//W3C//DTD XHTML 1.0 Frameset//EN</code>
+                    <li><code>-//W3C//DTD XHTML 1.1//EN</code>
+                </ul>
+              Then:
+                <ol>
+                    <li>All runs of characters apart from U+002D HYPHEN-MINUS
 (-), U+002E FULL STOP (.), U+0030 DIGIT ZERO to U+0039 DIGIT NINE (0–9),
-U+003A COLON (:), U+0041 LATIN CAPITAL LETTER A to U+005A LATIN CAPITAL LETTER Z
-(A–Z), U+005F LOW LINE (_), and U+0061 LATIN SMALL LETTER A to U+007A LATIN
+U+003A COLON (:), U+0041 LATIN CAPITAL LETTER A to U+005A LATIN CAPITAL LETTER
+Z (A–Z), U+005F LOW LINE (_), and U+0061 LATIN SMALL LETTER A to U+007A LATIN
 SMALL LETTER Z (a–z) are replaced by a single U+002D HYPHEN-MINUS (-)
 character within <var>generated_id</var>.
-					<li>Leading and trailing U+002D HYPHEN-MINUS (-) characters
+                    <li>Leading and trailing U+002D HYPHEN-MINUS (-) characters
 are removed from <var>generated_id</var>.
-					<li>If <var>generated_id</var> is not empty, if the first
-character is not in the range U+0041 LATIN CAPITAL LETTER A to U+005A LATIN
-CAPITAL LETTER Z (A–Z) or U+0061 LATIN SMALL LETTER A to U+007A LATIN SMALL
-LETTER Z (a–z), <var>generated_id</var> is prefixed by a single U+0078 LATIN
-SMALL LETTER X (x) character; otherwise, <var>generated_id</var> is set to
-<code>generatedID</code>.
-				</ol>
-			<li>Otherwise, runs of characters that do not match the ifragment
+                    <li>If <var>generated_id</var> is not empty and if the
+first character is not in the range U+0041 LATIN CAPITAL LETTER A to U+005A 
+LATIN CAPITAL LETTER Z (A–Z) or U+0061 LATIN SMALL LETTER A to U+007A LATIN 
+SMALL LETTER Z (a–z), <var>generated_id</var> is prefixed by a single U+0078 
+LATIN SMALL LETTER X (x) character.
+                </ol>
+            
+            <li>Otherwise, runs of characters that do not match the ifragment
 production in <a href="http://www.ietf.org/rfc/rfc3987">RFC 3987</a> are
 replaced by a single U+002D HYPHEN-MINUS (-) character within
 <var>generated_id</var>, and then leading and trailing U+002D HYPHEN-MINUS (-)
 characters are removed from <var>generated_id</var>.
-		</ol>
-	<li>If <var>generated_id</var> matches a ready-existing ID, continue to the
-next step; otherwise, jump to step 7.
-	<li>Increment <var>i</var> by one, or set it to one if it doesn't already
-exist.
-	<li>Go to step 4.
-	<li>The generated ID is <var>generated_id</var>.
+        </ol>
+    <li>If <var>generated_id</var> is empty, <var>generated_id</var> is set to <code>generatedID</code>.
+    <li>Let <var>output_id</var> equal <var>generated_id</var>.
+    <li>If <var>output_id</var> matches a ready-existing ID, continue to the
+next step; otherwise, jump to step 12.
+    <li>Increment <var>i</var> by one.
+    <li>Let <var>output_id</var> equal <var>generated_id</var> suffixed with a 
+U+002D HYPHEN-MINUS (-) character followed by <var>i</var> as a big-endian base 
+10 number.
+    <li>Jump back to step 8.
+    <li>The generated ID is <var>output_id</var>.
 </ol>
 
 <h2><dfn>Processes</dfn></h2>
 
 <p>The elements listed in the below processes, except where otherwise stated,
 are the local name of the element <!--either--> in null namespace<!-- or in the
-<dfn>HTML namespace</dfn> (<code>http://www.w3.org/1999/xhtml</code>)-->.</p>
+<dfn>HTML namespace</dfn> (<code>http://www.w3.org/1999/xhtml</code>)-->.
 
 <h3><dfn>Cross-referencing</dfn></h3>
 
-<p>Cross-referencing has three essential parts:
-<dfn title="definition">definitions</dfn> that define
-<dfn title="term">terms</dfn>, and <dfn title="instance">instances</dfn> of
-those <span title="term">terms</span>.</p>
+<p>Cross-referencing has three essential parts: <dfn
+title="definition">definitions</dfn> that define <dfn title="term">terms</dfn>,
+and <dfn title="instance">instances</dfn> of those <span
+title="term">terms</span>.
 
 <p><span title="definition">Definitions</span> are marked-up using the
 <code>dfn</code> element: the <span>definition</span> itself is taken from the
 title="definition">definitions</span>, the <span>instance</span> is taken from
 the <code>title</code> attribute if it is present, otherwise it is taken from
 the <span>textContent</span> property. An <span>instance</span> is only used if
-it does not have an <span>interactive content</span> or <code>dfn</code> element
-as either a parent or a child.</p>
+it does not have an <span>interactive content</span> or <code>dfn</code>
+element as either a parent or a child.
 
 <p>Both <span title="definition">definitions</span> and <span
 title="instance">instances</span> are <dfn title="cross-reference
-normalization">normalized</dfn> as follows:</p>
+normalization">normalized</dfn> as follows:
 
 <ul>
-	<li>Leading and trailing <span>whitespace</span> is stripped,
-	<li>Converted to lowercase (behaviour of this is dependent on the current
+    <li>Leading and trailing <span>whitespace</span> is stripped,
+    <li>Converted to lowercase (behaviour of this is dependent on the current
 locale setting of Python),
-	<li>All consecutive <span>whitespace</span> is replaced with a single U+0020
-SPACE CHARACTER<!-- unless there is a <code>pre</code> element as a parent-->,
-and
-	<li>If <dfn><code>--w3c-compat-xref-normalization</code></dfn> is enabled,
+    <li>All consecutive <span>whitespace</span> is replaced with a single
+U+0020 SPACE CHARACTER<!-- unless there is a <code>pre</code> element as a
+parent-->, and
+    <li>If <dfn><code>--w3c-compat-xref-normalization</code></dfn> is enabled,
 all characters apart from U+0020 SPACE CHARACTER, U+002D HYPHEN-MINUS (-),
-U+0030 DIGIT ZERO to U+0039 DIGIT NINE (0–9), U+0041 LATIN CAPITAL LETTER A to
-U+005A LATIN CAPITAL LETTER Z (A–Z), and U+0061 LATIN SMALL LETTER A to U+007A
-LATIN SMALL LETTER Z (a–z) are removed.
+U+0030 DIGIT ZERO to U+0039 DIGIT NINE (0–9), U+0041 LATIN CAPITAL LETTER A
+to U+005A LATIN CAPITAL LETTER Z (A–Z), and U+0061 LATIN SMALL LETTER A to
+U+007A LATIN SMALL LETTER Z (a–z) are removed.
 </ul>
 
-<p>If the <span>instance</span> is contained within a <code>span</code> element,
-the <code>span</code> element is turned into an <code>a</code> element, and a
-<code>href</code> attribute is added to link it to the <span>definition</span>
-(e.g., <code>&lt;span>foo&lt;/span></code> becomes <code>&lt;a
-href=#foo>foo&lt;/a></code>) — all other attributes are preserved. Otherwise
-(when the <span>instance</span> is not contained within a <code>span</code>
-element), the location of the <code>a</code> element when linking an
-<span>instance</span> is dependent on the
+<p>If the <span>instance</span> is contained within a <code>span</code>
+element, the <code>span</code> element is turned into an <code>a</code>
+element, and a <code>href</code> attribute is added to link it to the
+<span>definition</span> (e.g., <code>&lt;span>foo&lt;/span></code> becomes
+<code>&lt;a href=#foo>foo&lt;/a></code>) — all other attributes are
+preserved. Otherwise (when the <span>instance</span> is not contained within a
+<code>span</code> element), the location of the <code>a</code> element when
+linking an <span>instance</span> is dependent on the
 <dfn><code>--w3c-compat-xref-a-placement</code></dfn> option: if it is disabled
 (the default), the <code>a</code> element is placed around the element
 containing the <span>instance</span> (e.g., <code>&lt;i>foo&lt;/i></code>
-becomes <code>&lt;a href=#foo>&lt;i>foo&lt;/i>&lt;/a></code>); if it is enabled,
-the <code>a</code> element goes within the element containing the
+becomes <code>&lt;a href=#foo>&lt;i>foo&lt;/i>&lt;/a></code>); if it is
+enabled, the <code>a</code> element goes within the element containing the
 <span>instance</span> and goes around all of its content (e.g.,
 <code>&lt;i>foo&lt;/i></code> becomes <code>&lt;i>&lt;a
-href=#foo>foo&lt;/a>&lt;/i></code>).</p>
+href=#foo>foo&lt;/a>&lt;/i></code>).
 
 <h3><dfn>Table of contents/section numbering</dfn></h3>
 
 <p>To create a table of contents, and to number the <span
 title="section">sections</span> of the document, an <dfn>outline</dfn> is
-created (this is a list of <span title="section">sections</span>, which can each
-contain more <span title="section">sections</span>, where a <dfn>section</dfn>
-represents a part of the document, and often has a <dfn title="section
-heading">heading</dfn> associated with it — for more detailed definitions see
-<a href="http://whatwg.org/html5">HTML 5</a>). This means not only are the
-<code>h1</code>–<code>h6</code> elements supported, but also elements such as
-<code title="">section</code> are used to create the <span>outline</span>. After
-creating the
-<span>outline</span>, every <span>section</span> with a depth between those
-provided by <dfn><code>--min-depth</code></dfn> and
-<dfn><code>--max-depth</code></dfn> (defaulting to two and six respectively),
-and which has a <span title="section heading">heading</span>, is numbered if it
-does not have <code>no-num</code> as a class, and is added to the table of
-contents if it does not have <code>no-toc</code> as a class. <span
-title="section">Sections</span> without a <span title="section
-heading">heading</span> are treated as if they did not exist, unless they have
-children, in which they will appear to exist while not existing all at once
-(e.g., they increment the <span>section</span> numbering, though that is not
-output anywhere; and they get a list item in the table of contents, with only
-the children within it, and no link to the <span>section</span> itself).</p>
+created (this is a list of <span title="section">sections</span>, which can
+each contain more <span title="section">sections</span>, where a
+<dfn>section</dfn> represents a part of the document, and often has a <dfn
+title="section heading">heading</dfn> associated with it — for more detailed
+definitions see <a href="http://whatwg.org/html5">HTML 5</a>). This means not
+only are the <code>h1</code>–<code>h6</code> elements supported, but also
+elements such as <code title="">section</code> are used to create the
+<span>outline</span>. After creating the <span>outline</span>, every
+<span>section</span> with a depth between those provided by
+<dfn><code>--min-depth</code></dfn> and <dfn><code>--max-depth</code></dfn>
+(defaulting to two and six respectively), and which has a <span title="section
+heading">heading</span>, is numbered if it does not have <code>no-num</code> as
+a class, and is added to the table of contents if it does not have
+<code>no-toc</code> as a class. <span title="section">Sections</span> without a
+<span title="section heading">heading</span> are treated as if they did not
+exist, unless they have children, in which they will appear to exist while not
+existing all at once (e.g., they increment the <span>section</span> numbering,
+though that is not output anywhere; and they get a list item in the table of
+contents, with only the children within it, and no link to the
+<span>section</span> itself).
 
 <p>The format of <span>section</span> numbers should comply with <a
 href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=6937">ISO
 2145:1978</a>, Numbering of divisions and subdivisions in written documents.
 This means that each <span>section</span> number is given by Arabic numerals,
 seperated by a single U+002E FULL STOP character, and there is no trailing
-U+002E FULL STOP character.</p>
+U+002E FULL STOP character.
 
 <p>The <span>section</span> number is inserted as the first child node of the
 <span>section heading</span> as a <code>span</code> element with the
 <code>class</code> attribute set to <code>secno</code>: this is copied into the
-table of contents.</p>
+table of contents.
 
 <p>Pre-existing <code>span</code> elements with a class of <code>secno</code>
 are removed from all <span title="section heading">section headings</span>,
 regardless of whether their depth falls within the range given by
-<code>--min-depth</code> and <code>--max-depth</code>.</p>
+<code>--min-depth</code> and <code>--max-depth</code>.
 
 <p>The table of contents is built up as an ordered list (an <code>ol</code>
-element), with each <span>section</span> marked up as a <code>li</code> element,
-and child <span title="section">sections</span> are marked up with an
+element), with each <span>section</span> marked up as a <code>li</code>
+element, and child <span title="section">sections</span> are marked up with an
 <code>ol</code> within that <code>li</code> (and this continues recursively, ad
 infinitum). By default, the root element of the table of contents (an
 <code>ol</code> element) is given a <code>class</code> attribute set to
 <code>ol</code> within the table of contents. The entire <span>section
 heading</span> is copied to be the content of the list item, with all
 <span>interactive content</span> elements and <code>id</code> attributes
-removed.</p>
+removed.
 
 <p>A <span>normal comment substitution</span> is done with
 <var>sub_identifier</var> equal to <code>toc</code>, and the table of contents
-as the replacement.</p>
+as the replacement.
 
 <h3><dfn>Substitution</dfn></h3>
 
 BRACKET character — these extra characters are effectively a comment, and
 carry absolutely no meaning, and vanish into some as-of-yet unknown abyss when
 the string replacement is done. The entire string must be contained within a
-single text node.</p>
+single text node.
 
 <p>A <dfn>normal comment substitution</dfn> is one where there is a string,
-<var>sub_identifier</var>, that identifies the comment for the substitution, and
-the replacement. All nodes between a comment with a value equal to (with leading
-and trailing <span>whitespace</span> removed) <code>begin-</code> followed by
-<var>sub_identifier</var> and one with q value equal to (with leading and
-trailing <span>whitespace</span> removed) <code>end-</code> followed by
-<var>sub_identifier</var> are removed, and replaced with the replacement.
-Additionally, any comment (with leading and trailing <span>whitespace</span>
-removed) with a value equal to <var>sub_identifier</var> is replaced with a
-comment with a value of <code>begin-</code> followed by
-<var>sub_identifier</var>, the replacement, and then a comment with a value of
-<code>end-</code> followed by <var>sub_identifier</var>.</p>
+<var>sub_identifier</var>, that identifies the comment for the substitution,
+and the replacement. All nodes between a comment with a value equal to (with
+leading and trailing <span>whitespace</span> removed) <code>begin-</code>
+followed by <var>sub_identifier</var> and one with q value equal to (with
+leading and trailing <span>whitespace</span> removed) <code>end-</code>
+followed by <var>sub_identifier</var> are removed, and replaced with the
+replacement. Additionally, any comment (with leading and trailing
+<span>whitespace</span> removed) with a value equal to
+<var>sub_identifier</var> is replaced with a comment with a value of
+<code>begin-</code> followed by <var>sub_identifier</var>, the replacement, and
+then a comment with a value of <code>end-</code> followed by
+<var>sub_identifier</var>.
 
 <p>The <dfn>W3C status</dfn> is found, when needed by one of the substitutions,
 by iterating all text nodes in document order (i.e., attribute values and
 comments have no effect), and for each node, the following is done (in this
-order):</p>
+order):
 
 <ol>
-	<li>If the node contains, case-insensitively, "latest", followed by one or
-more <span>whitespace</span> characters, followed by "version", searching stops,
-and the default is used (ED).
-	<li>Otherwise, if the node, case-sensitively, contains
-"http://www.w3.org/TR/" followed by one of "MO", "WD", "CR", "PR", "REC", "PER",
-or "NOTE", which in turn is followed by U+002D HYPHEN-MINUS (-), then searching
-stops, and the status is whatever matched the previous list of options by the
-first match in the text node.
+    <li>If the node contains, case-insensitively, "latest", followed by one or
+more <span>whitespace</span> characters, followed by "version", searching
+stops, and the default is used (ED).
+    <li>Otherwise, if the node, case-sensitively, contains
+"http://www.w3.org/TR/" followed by one of "MO", "WD", "CR", "PR", "REC",
+"PER", or "NOTE", which in turn is followed by U+002D HYPHEN-MINUS (-), then
+searching stops, and the status is whatever matched the previous list of
+options by the first match in the text node.
 </ol>
 
 <p>A side-effect of doing it in this order is the fact that if a node contains
 both of these possible strings is that the latter is ignored, meaning that the
-default (ED) is used.</p>
+default (ED) is used.
 
 <!-- I wish the above was more sane — it took me several hours to work out
-(though the comment in the CSS3 Module Postprocessor docs saying, "If there is a
-H2 subheading under the H1 that gives the spec's status, the [STATUS] variable
-will be initialized from that, otherwise it will default to WD." did not help me
-work it out quickly, as what is done is completely utterly different to that)
-— even though the algorithm is simple enough, it is just far too unexpected.
-Sadly, though, pre-existing documents depend on this very exact behaviour, and
-thus it cannot be changed. -->
+(though the comment in the CSS3 Module Postprocessor docs saying, "If there is
+a H2 subheading under the H1 that gives the spec's status, the [STATUS]
+variable will be initialized from that, otherwise it will default to WD." did
+not help me work it out quickly, as what is done is completely utterly
+different to that) — even though the algorithm is simple enough, it is just
+far too unexpected. Sadly, though, pre-existing documents depend on this very
+exact behaviour, and thus it cannot be changed. -->
 
-<p>There is also a <dfn>long W3C status</dfn>, which correlates to the <span>W3C
-status</span> under the following mapping:</p>
+<p>There is also a <dfn>long W3C status</dfn>, which correlates to the
+<span>W3C status</span> under the following mapping:
 
 <table>
-	<tr>
-		<th><span>W3C Status</span>
-		<th><span>Long W3C Status</span>
-	<tr>
-		<td>MO
-		<td>W3C Member-only Draft
-	<tr>
-		<td>ED
-		<td>Editor's Draft
-	<tr>
-		<td>WD
-		<td>W3C Working Draft
-	<tr>
-		<td>CR
-		<td>W3C Candidate Recommendation
-	<tr>
-		<td>PR
-		<td>W3C Proposed Recommendation
-	<tr>
-		<td>REC
-		<td>W3C Recommendation
-	<tr>
-		<td>PER
-		<td>W3C Proposed Edited Recommendation
-	<tr>
-		<td>NOTE
-		<td>W3C Working Group Note
+    <tr>
+        <th><span>W3C Status</span>
+        <th><span>Long W3C Status</span>
+    <tr>
+        <td>MO
+        <td>W3C Member-only Draft
+    <tr>
+        <td>ED
+        <td>Editor's Draft
+    <tr>
+        <td>WD
+        <td>W3C Working Draft
+    <tr>
+        <td>CR
+        <td>W3C Candidate Recommendation
+    <tr>
+        <td>PR
+        <td>W3C Proposed Recommendation
+    <tr>
+        <td>REC
+        <td>W3C Recommendation
+    <tr>
+        <td>PER
+        <td>W3C Proposed Edited Recommendation
+    <tr>
+        <td>NOTE
+        <td>W3C Working Group Note
 </table>
 
 <p>By default, the <span title="normal string substitution">normal string
-substitutions</span> are:</p>
+substitutions</span> are:
 
 <dl>
-	<dt><code>[<!---->DATE]</code>
-	<dd>This is replaced with the current date for UTC±0 in the form of, e.g.,
+    <dt><code>[<!---->DATE]</code>
+    <dd>This is replaced with the current date for UTC±0 in the form of, e.g.,
 <samp>31 July 2008</samp>. The word used for the month is dependent on the
 current locale of Python. The number of the day of the month has no leading
 zeros.
-	<dt><code>[<!---->CDATE]</code>
-	<dd>This is replaced with the current date for UTC±0 in the form YYYYMMDD,
+    
+    <dt><code>[<!---->CDATE]</code>
+    <dd>This is replaced with the current date for UTC±0 in the form YYYYMMDD,
 e.g., <samp>20080731</samp>. This is a conforming <a
 href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=40874">ISO
 8601:2004</a> date.
-	<dt><code>[<!---->YEAR]</code>
-	<dd>This is replaced with the current year for UTC±0, in the form YYYY,
-e.g.,
-<samp>2008</samp>. This is a conforming <a
+    
+    <dt><code>[<!---->YEAR]</code>
+    <dd>This is replaced with the current year for UTC±0, in the form YYYY,
+e.g., <samp>2008</samp>. This is a conforming <a
 href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=40874">ISO
 8601:2004</a> year.
-	<dt><code>[<!---->TITLE]</code>
-	<dd>This is replaced with the <span>textContent</span> of the first
+    
+    <dt><code>[<!---->TITLE]</code>
+    <dd>This is replaced with the <span>textContent</span> of the first
 <code>title</code> element which is within the first <code>head</code> of the
 document, or an empty string if such a <code>title</code> element does not
 exist.
 <code>a</code> element which has a <code>href</code> attribute equal to the
 <code>textContent</code> of all the nodes between the two comments concatenated
 in document order. The two comments must have the same parent, otherwise a
-<span>fatal error</span> occurs.</p>
+<span>fatal error</span> occurs.
 
 <p>If <dfn><code>--w3c-compat-substitutions</code></dfn> is enabled, the
 following <span title="normal string substitution">normal string
-substitutions</span> are done in addition to those above:</p>
+substitutions</span> are done in addition to those above:
 
 <dl>
-	<dt><code>[STATUS]</code>
-	<dd>This is replaced with the <span>W3C status</span>.
-	<dt><code>[LONGSTATUS]</code>
-	<dd>This is replaced with the <span>long W3C status</span>.
+    <dt><code>[STATUS]</code>
+    <dd>This is replaced with the <span>W3C status</span>.
+    
+    <dt><code>[LONGSTATUS]</code>
+    <dd>This is replaced with the <span>long W3C status</span>.
 </dl>
 
 <p>Additionally, the following <span title="normal comment substitution">normal
-comment substitutions</span> are done:</p>
+comment substitutions</span> are done:
 
 <dl>
-	<dt><var>sub_identifier</var> equal to <code>logo</code>
-	<dd>Replacement is equal to: <code>&lt;p>&lt;a
+    <dt><var>sub_identifier</var> equal to <code>logo</code>
+    <dd>Replacement is equal to: <code>&lt;p>&lt;a
 href="http://www.w3.org/">&lt;img alt="W3C"
 src="http://www.w3.org/Icons/w3c_home"/>&lt;/a>&lt;/p></code> (parsed as an XML
 fragment, and serialized into the output document in the needed format).
-	
-	<dt><var>sub_identifier</var> equal to <code>copyright</code>
-	<dd>Replacement is equal to: <code>&lt;p class="copyright">&lt;a
+    
+    <dt><var>sub_identifier</var> equal to <code>copyright</code> 
+    <dd>Replacement is equal to: <code>&lt;p class="copyright">&lt;a
 href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright&lt;/a>
 &#xA9; [<!---->YEAR] &lt;a href="http://www.w3.org/">&lt;acronym title="World
 Wide Web Consortium">W3C&lt;/acronym>&lt;/a>&lt;sup>&#xAE;&lt;/sup> (&lt;a
 href="http://www.csail.mit.edu/">&lt;acronym title="Massachusetts Institute of
 Technology">MIT&lt;/acronym>&lt;/a>, &lt;a
-href="http://www.ercim.org/">&lt;acronym title="European Research Consortium for
-Informatics and Mathematics">ERCIM&lt;/acronym>&lt;/a>, &lt;a
+href="http://www.ercim.org/">&lt;acronym title="European Research Consortium
+for Informatics and Mathematics">ERCIM&lt;/acronym>&lt;/a>, &lt;a
 href="http://www.keio.ac.jp/">Keio&lt;/a>), All Rights Reserved. W3C &lt;a
 href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability&lt;/a>,
 &lt;a
 href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark&lt;/a>
-and &lt;a href="http://www.w3.org/Consortium/Legal/copyright-documents">document
-use&lt;/a> rules apply.&lt;/p></code> (parsed as an XML fragment, and serialized
-into the output document in the needed format).
+and &lt;a
+href="http://www.w3.org/Consortium/Legal/copyright-documents">document
+use&lt;/a> rules apply.&lt;/p></code> (parsed as an XML fragment, and
+serialized into the output document in the needed format).
 </dl>
 
 <p>There is one further string substitution, and this is only done when
 <code>http://www.w3.org/StyleSheets/TR/W3C-</code> followed by one or more
 characters in the range U+0041 LATIN CAPITAL LETTER A to U+005A LATIN CAPITAL
 LETTER Z (A–Z) is replaced with whatever
-<code>http://www.w3.org/StyleSheets/TR/W3C-[STATUS]</code> would evaluate to be.
-Like the <span title="normal string substitution">normal string
-substitutions</span>, this string must be contained in a single text node.</p>
+<code>http://www.w3.org/StyleSheets/TR/W3C-[STATUS]</code> would evaluate to
+be. Like the <span title="normal string substitution">normal string
+substitutions</span>, this string must be contained in a single text node.
 
 <!-- Is that crazy enough to justify the option name? -->
 
 
 <p>Thanks to Andrew Sidwell, Anne van Kesteren, Henri Sivonen, Ian Hickson,
 James Graham, Lachlan Hunt, Magnus Kristiansen, Michael(tm) Smith, and Philip
-Taylor for their ever needed help.</p>
+Taylor for their ever needed help.
 
 <p>Special thanks to Bert Bos for creating the CSS3 Module Postprocessor, on
-which this is partially based, and (with <code>--w3c-compat</code>) claims to be
-partially compatible with. Further special thanks to Bert Bos for creating a
+which this is partially based, and (with <code>--w3c-compat</code>) claims to
+be partially compatible with. Further special thanks to Bert Bos for creating a
 number of things (especially the algorithm for finding the <span>W3C
 status</span>) that took the author of Anolis many hours to reverse
-engineer.</p>
+engineer.