summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY.txt3
-rw-r--r--docutils/writers/html4css1/__init__.py41
-rw-r--r--docutils/writers/s5_html/__init__.py4
-rw-r--r--test/functional/expected/pep_html.html16
-rw-r--r--test/functional/expected/standalone_rst_html4css1.html166
-rw-r--r--test/functional/expected/standalone_rst_s5_html_1.html4
-rw-r--r--test/functional/expected/standalone_rst_s5_html_2.html4
-rwxr-xr-xtest/test_writers/test_html4css1_parts.py48
-rwxr-xr-xtest/test_writers/test_html4css1_template.py16
9 files changed, 142 insertions, 160 deletions
diff --git a/HISTORY.txt b/HISTORY.txt
index 569e717a8..a68568e93 100644
--- a/HISTORY.txt
+++ b/HISTORY.txt
@@ -78,6 +78,9 @@ Changes Since 0.4
- Moved template functionality from the PEP/HTML writer here.
- Expanded the fragments available in the ``parts`` attribute.
+ - Moved ``id`` attributes from titles to surrounding ``div``
+ elements; dropped ``name`` attributes (``id`` is universally
+ supported now).
* docutils/writers/html4css1/template.txt: Added to project.
diff --git a/docutils/writers/html4css1/__init__.py b/docutils/writers/html4css1/__init__.py
index 22fb85747..59e8adabb 100644
--- a/docutils/writers/html4css1/__init__.py
+++ b/docutils/writers/html4css1/__init__.py
@@ -407,12 +407,6 @@ class HTMLTranslator(nodes.NodeVisitor):
"""Construct and return an XML-compatible empty tag."""
return self.starttag(node, tagname, suffix, empty=1, **attributes)
- # !!! to be removed in Docutils 0.5 (change calls to use "starttag"):
- def start_tag_with_title(self, node, tagname, **atts):
- """ID and NAME attributes will be handled in the title."""
- node = {'classes': node.get('classes', [])}
- return self.starttag(node, tagname, **atts)
-
def set_class_on_child(self, node, class_, index=0):
"""
Set class `class_` on the visible child no. index of `node`.
@@ -462,7 +456,7 @@ class HTMLTranslator(nodes.NodeVisitor):
self.depart_docinfo_item()
def visit_admonition(self, node):
- self.body.append(self.start_tag_with_title(node, 'div'))
+ self.body.append(self.starttag(node, 'div'))
self.set_first_last(node)
def depart_admonition(self, node=None):
@@ -721,6 +715,7 @@ class HTMLTranslator(nodes.NodeVisitor):
self.html_body.extend(self.body_prefix[1:] + self.body_pre_docinfo
+ self.docinfo + self.body
+ self.body_suffix[:-1])
+ assert not self.context, 'internal error: context not empty'
def visit_emphasis(self, node):
self.body.append('<em>')
@@ -1264,7 +1259,7 @@ class HTMLTranslator(nodes.NodeVisitor):
def visit_section(self, node):
self.section_level += 1
self.body.append(
- self.start_tag_with_title(node, 'div', CLASS='section'))
+ self.starttag(node, 'div', CLASS='section'))
def depart_section(self, node):
self.section_level -= 1
@@ -1272,7 +1267,7 @@ class HTMLTranslator(nodes.NodeVisitor):
def visit_sidebar(self, node):
self.body.append(
- self.start_tag_with_title(node, 'div', CLASS='sidebar'))
+ self.starttag(node, 'div', CLASS='sidebar'))
self.set_first_last(node)
self.in_sidebar = 1
@@ -1429,30 +1424,26 @@ class HTMLTranslator(nodes.NodeVisitor):
def depart_thead(self, node):
self.body.append('</thead>\n')
- def visit_title(self, node, move_ids=1):
+ def visit_title(self, node):
"""Only 6 section levels are supported by HTML."""
check_id = 0
close_tag = '</p>\n'
if isinstance(node.parent, nodes.topic):
self.body.append(
self.starttag(node, 'p', '', CLASS='topic-title first'))
- check_id = 1
elif isinstance(node.parent, nodes.sidebar):
self.body.append(
self.starttag(node, 'p', '', CLASS='sidebar-title'))
- check_id = 1
elif isinstance(node.parent, nodes.Admonition):
self.body.append(
self.starttag(node, 'p', '', CLASS='admonition-title'))
- check_id = 1
elif isinstance(node.parent, nodes.table):
self.body.append(
self.starttag(node, 'caption', ''))
- check_id = 1
close_tag = '</caption>\n'
elif isinstance(node.parent, nodes.document):
self.body.append(self.starttag(node, 'h1', '', CLASS='title'))
- self.context.append('</h1>\n')
+ close_tag = '</h1>\n'
self.in_document_title = len(self.body)
else:
assert isinstance(node.parent, nodes.section)
@@ -1464,27 +1455,15 @@ class HTMLTranslator(nodes.NodeVisitor):
self.body.append(
self.starttag(node, 'h%s' % h_level, '', **atts))
atts = {}
- # !!! conditional to be removed in Docutils 0.5:
- if move_ids:
- if node.parent['ids']:
- atts['ids'] = node.parent['ids']
if node.hasattr('refid'):
atts['class'] = 'toc-backref'
atts['href'] = '#' + node['refid']
if atts:
self.body.append(self.starttag({}, 'a', '', **atts))
- self.context.append('</a></h%s>\n' % (h_level))
- else:
- self.context.append('</h%s>\n' % (h_level))
- # !!! conditional to be removed in Docutils 0.5:
- if check_id:
- if node.parent['ids']:
- atts={'ids': node.parent['ids']}
- self.body.append(
- self.starttag({}, 'a', '', **atts))
- self.context.append('</a>' + close_tag)
+ close_tag = '</a></h%s>\n' % (h_level)
else:
- self.context.append(close_tag)
+ close_tag = '</h%s>\n' % (h_level)
+ self.context.append(close_tag)
def depart_title(self, node):
self.body.append(self.context.pop())
@@ -1502,7 +1481,7 @@ class HTMLTranslator(nodes.NodeVisitor):
self.body.append('</cite>')
def visit_topic(self, node):
- self.body.append(self.start_tag_with_title(node, 'div', CLASS='topic'))
+ self.body.append(self.starttag(node, 'div', CLASS='topic'))
self.topic_classes = node['classes']
def depart_topic(self, node):
diff --git a/docutils/writers/s5_html/__init__.py b/docutils/writers/s5_html/__init__.py
index 96a8df544..486c03f4a 100644
--- a/docutils/writers/s5_html/__init__.py
+++ b/docutils/writers/s5_html/__init__.py
@@ -333,5 +333,5 @@ class S5HTMLTranslator(html4css1.HTMLTranslator):
else:
html4css1.HTMLTranslator.visit_subtitle(self, node)
- def visit_title(self, node, move_ids=0):
- html4css1.HTMLTranslator.visit_title(self, node, move_ids=move_ids)
+ def visit_title(self, node):
+ html4css1.HTMLTranslator.visit_title(self, node)
diff --git a/test/functional/expected/pep_html.html b/test/functional/expected/pep_html.html
index 716b11d0c..7f55af60c 100644
--- a/test/functional/expected/pep_html.html
+++ b/test/functional/expected/pep_html.html
@@ -54,25 +54,25 @@ to templates. DO NOT USE THIS HTML FILE AS YOUR TEMPLATE!
</tbody>
</table>
<hr />
-<div class="contents topic">
-<p class="topic-title first"><a id="contents" name="contents">Contents</a></p>
+<div class="contents topic" id="contents">
+<p class="topic-title first">Contents</p>
<ul class="simple">
<li><a class="reference" href="#abstract" id="id5" name="id5">Abstract</a></li>
<li><a class="reference" href="#copyright" id="id6" name="id6">Copyright</a></li>
<li><a class="reference" href="#references-and-footnotes" id="id7" name="id7">References and Footnotes</a></li>
</ul>
</div>
-<div class="section">
-<h1><a class="toc-backref" href="#id5" id="abstract" name="abstract">Abstract</a></h1>
+<div class="section" id="abstract">
+<h1><a class="toc-backref" href="#id5">Abstract</a></h1>
<p>This is just a test <a class="footnote-reference" href="#id2" id="id1" name="id1">[1]</a>. See the <a class="reference" href="http://www.python.org/peps/">PEP repository</a> <a class="footnote-reference" href="#id3" id="id4" name="id4">[2]</a> for the real
thing.</p>
</div>
-<div class="section">
-<h1><a class="toc-backref" href="#id6" id="copyright" name="copyright">Copyright</a></h1>
+<div class="section" id="copyright">
+<h1><a class="toc-backref" href="#id6">Copyright</a></h1>
<p>This document has been placed in the public domain.</p>
</div>
-<div class="section">
-<h1><a class="toc-backref" href="#id7" id="references-and-footnotes" name="references-and-footnotes">References and Footnotes</a></h1>
+<div class="section" id="references-and-footnotes">
+<h1><a class="toc-backref" href="#id7">References and Footnotes</a></h1>
<table class="docutils footnote" frame="void" id="id2" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
diff --git a/test/functional/expected/standalone_rst_html4css1.html b/test/functional/expected/standalone_rst_html4css1.html
index 5c1c2072a..6ceb439cc 100644
--- a/test/functional/expected/standalone_rst_html4css1.html
+++ b/test/functional/expected/standalone_rst_html4css1.html
@@ -82,8 +82,8 @@ transforms to after the document title, subtitle, and docinfo. -->
<!-- Above is the document title, and below is the subtitle.
They are transformed from section titles after parsing. -->
<!-- bibliographic fields (which also require a transform): -->
-<div class="contents topic">
-<p class="topic-title first"><a id="table-of-contents" name="table-of-contents">Table of Contents</a></p>
+<div class="contents topic" id="table-of-contents">
+<p class="topic-title first">Table of Contents</p>
<ul class="auto-toc simple">
<li><a class="reference" href="#structural-elements" id="id32" name="id32">1&nbsp;&nbsp;&nbsp;Structural Elements</a><ul class="auto-toc">
<li><a class="reference" href="#section-title" id="id33" name="id33">1.1&nbsp;&nbsp;&nbsp;Section Title</a></li>
@@ -137,31 +137,31 @@ They are transformed from section titles after parsing. -->
<li><a class="reference" href="#error-handling" id="id71" name="id71">3&nbsp;&nbsp;&nbsp;Error Handling</a></li>
</ul>
</div>
-<div class="section">
-<h1><a class="toc-backref" href="#id32" id="structural-elements" name="structural-elements">1&nbsp;&nbsp;&nbsp;Structural Elements</a></h1>
-<div class="section">
-<h2 class="with-subtitle"><a class="toc-backref" href="#id33" id="section-title" name="section-title">1.1&nbsp;&nbsp;&nbsp;Section Title</a></h2>
+<div class="section" id="structural-elements">
+<h1><a class="toc-backref" href="#id32">1&nbsp;&nbsp;&nbsp;Structural Elements</a></h1>
+<div class="section" id="section-title">
+<h2 class="with-subtitle"><a class="toc-backref" href="#id33">1.1&nbsp;&nbsp;&nbsp;Section Title</a></h2>
<h2 class="section-subtitle" id="section-subtitle"><span class="section-subtitle">Section Subtitle</span></h2>
<p>That's it, the text just above this line.</p>
</div>
-<div class="section">
-<h2><a class="toc-backref" href="#id34" id="empty-section" name="empty-section">1.2&nbsp;&nbsp;&nbsp;Empty Section</a></h2>
+<div class="section" id="empty-section">
+<h2><a class="toc-backref" href="#id34">1.2&nbsp;&nbsp;&nbsp;Empty Section</a></h2>
</div>
-<div class="section">
-<h2><a class="toc-backref" href="#id35" id="transitions" name="transitions">1.3&nbsp;&nbsp;&nbsp;Transitions</a></h2>
+<div class="section" id="transitions">
+<h2><a class="toc-backref" href="#id35">1.3&nbsp;&nbsp;&nbsp;Transitions</a></h2>
<p>Here's a transition:</p>
<hr class="docutils" />
<p>It divides the section. Transitions may also occur between sections:</p>
</div>
</div>
<hr class="docutils" />
-<div class="section">
-<h1><a class="toc-backref" href="#id36" id="body-elements" name="body-elements">2&nbsp;&nbsp;&nbsp;Body Elements</a></h1>
-<div class="section">
-<h2><a class="toc-backref" href="#id37" id="paragraphs" name="paragraphs">2.1&nbsp;&nbsp;&nbsp;Paragraphs</a></h2>
+<div class="section" id="body-elements">
+<h1><a class="toc-backref" href="#id36">2&nbsp;&nbsp;&nbsp;Body Elements</a></h1>
+<div class="section" id="paragraphs">
+<h2><a class="toc-backref" href="#id37">2.1&nbsp;&nbsp;&nbsp;Paragraphs</a></h2>
<p>A paragraph.</p>
-<div class="section">
-<h3><a class="toc-backref" href="#id38" id="inline-markup" name="inline-markup">2.1.1&nbsp;&nbsp;&nbsp;Inline Markup</a></h3>
+<div class="section" id="inline-markup">
+<h3><a class="toc-backref" href="#id38">2.1.1&nbsp;&nbsp;&nbsp;Inline Markup</a></h3>
<p>Paragraphs contain text and may contain inline markup: <em>emphasis</em>,
<strong>strong emphasis</strong>, <tt class="docutils literal"><span class="pre">inline</span> <span class="pre">literals</span></tt>, standalone hyperlinks
(<a class="reference" href="http://www.python.org">http://www.python.org</a>), external hyperlinks (<a class="reference" href="http://www.python.org/">Python</a> <a class="footnote-reference" href="#id25" id="id26" name="id26">[5]</a>), internal
@@ -191,8 +191,8 @@ and explicit roles for <em>standard</em> <strong>inline</strong>
live link to PEP 258 here.</p>
</div>
</div>
-<div class="section">
-<h2><a class="toc-backref" href="#id39" id="bullet-lists" name="bullet-lists">2.2&nbsp;&nbsp;&nbsp;Bullet Lists</a></h2>
+<div class="section" id="bullet-lists">
+<h2><a class="toc-backref" href="#id39">2.2&nbsp;&nbsp;&nbsp;Bullet Lists</a></h2>
<ul>
<li><p class="first">A bullet list</p>
<ul class="simple">
@@ -216,8 +216,8 @@ live link to PEP 258 here.</p>
</li>
</ul>
</div>
-<div class="section">
-<h2><a class="toc-backref" href="#id40" id="enumerated-lists" name="enumerated-lists">2.3&nbsp;&nbsp;&nbsp;Enumerated Lists</a></h2>
+<div class="section" id="enumerated-lists">
+<h2><a class="toc-backref" href="#id40">2.3&nbsp;&nbsp;&nbsp;Enumerated Lists</a></h2>
<ol class="arabic">
<li><p class="first">Arabic numerals.</p>
<ol class="loweralpha simple">
@@ -249,8 +249,8 @@ live link to PEP 258 here.</p>
</li>
</ol>
</div>
-<div class="section">
-<h2><a class="toc-backref" href="#id41" id="definition-lists" name="definition-lists">2.4&nbsp;&nbsp;&nbsp;Definition Lists</a></h2>
+<div class="section" id="definition-lists">
+<h2><a class="toc-backref" href="#id41">2.4&nbsp;&nbsp;&nbsp;Definition Lists</a></h2>
<dl class="docutils">
<dt>Term</dt>
<dd>Definition</dd>
@@ -264,8 +264,8 @@ live link to PEP 258 here.</p>
<dd>Definition</dd>
</dl>
</div>
-<div class="section">
-<h2><a class="toc-backref" href="#id42" id="field-lists" name="field-lists">2.5&nbsp;&nbsp;&nbsp;Field Lists</a></h2>
+<div class="section" id="field-lists">
+<h2><a class="toc-backref" href="#id42">2.5&nbsp;&nbsp;&nbsp;Field Lists</a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
@@ -288,8 +288,8 @@ doesn't get stripped away.)</p>
</tbody>
</table>
</div>
-<div class="section">
-<h2><a class="toc-backref" href="#id43" id="option-lists" name="option-lists">2.6&nbsp;&nbsp;&nbsp;Option Lists</a></h2>
+<div class="section" id="option-lists">
+<h2><a class="toc-backref" href="#id43">2.6&nbsp;&nbsp;&nbsp;Option Lists</a></h2>
<p>For listing command-line options:</p>
<table class="docutils option-list" frame="void" rules="none">
<col class="option" />
@@ -334,8 +334,8 @@ regardless of where it starts.</p>
<p>There must be at least two spaces between the option and the
description.</p>
</div>
-<div class="section">
-<h2><a class="toc-backref" href="#id44" id="literal-blocks" name="literal-blocks">2.7&nbsp;&nbsp;&nbsp;Literal Blocks</a></h2>
+<div class="section" id="literal-blocks">
+<h2><a class="toc-backref" href="#id44">2.7&nbsp;&nbsp;&nbsp;Literal Blocks</a></h2>
<p>Literal blocks are indicated with a double-colon (&quot;::&quot;) at the end of
the preceding paragraph (over there <tt class="docutils literal"><span class="pre">--&gt;</span></tt>). They can be indented:</p>
<pre class="literal-block">
@@ -351,8 +351,8 @@ if literal_block:
&gt; Why didn't I think of that?
</pre>
</div>
-<div class="section">
-<h2><a class="toc-backref" href="#id45" id="line-blocks" name="line-blocks">2.8&nbsp;&nbsp;&nbsp;Line Blocks</a></h2>
+<div class="section" id="line-blocks">
+<h2><a class="toc-backref" href="#id45">2.8&nbsp;&nbsp;&nbsp;Line Blocks</a></h2>
<p>This section tests line blocks. Line blocks are body elements which
consist of lines and other line blocks. Nested line blocks cause
indentation.</p>
@@ -410,8 +410,8 @@ the left edge of the text above it.</div>
</div>
</blockquote>
</div>
-<div class="section">
-<h2><a class="toc-backref" href="#id46" id="block-quotes" name="block-quotes">2.9&nbsp;&nbsp;&nbsp;Block Quotes</a></h2>
+<div class="section" id="block-quotes">
+<h2><a class="toc-backref" href="#id46">2.9&nbsp;&nbsp;&nbsp;Block Quotes</a></h2>
<p>Block quotes consist of indented body elements:</p>
<blockquote>
<p>My theory by A. Elk. Brackets Miss, brackets. This theory goes
@@ -422,8 +422,8 @@ own it, and what it is too.</p>
<p class="attribution">&mdash;Anne Elk (Miss)</p>
</blockquote>
</div>
-<div class="section">
-<h2><a class="toc-backref" href="#id47" id="doctest-blocks" name="doctest-blocks">2.10&nbsp;&nbsp;&nbsp;Doctest Blocks</a></h2>
+<div class="section" id="doctest-blocks">
+<h2><a class="toc-backref" href="#id47">2.10&nbsp;&nbsp;&nbsp;Doctest Blocks</a></h2>
<pre class="doctest-block">
&gt;&gt;&gt; print 'Python-specific usage examples; begun with &quot;&gt;&gt;&gt;&quot;'
Python-specific usage examples; begun with &quot;&gt;&gt;&gt;&quot;
@@ -431,8 +431,8 @@ Python-specific usage examples; begun with &quot;&gt;&gt;&gt;&quot;
(cut and pasted from interactive Python sessions)
</pre>
</div>
-<div class="section">
-<h2><a class="toc-backref" href="#id48" id="footnotes" name="footnotes">2.11&nbsp;&nbsp;&nbsp;Footnotes</a></h2>
+<div class="section" id="footnotes">
+<h2><a class="toc-backref" href="#id48">2.11&nbsp;&nbsp;&nbsp;Footnotes</a></h2>
<table class="docutils footnote" frame="void" id="id8" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
@@ -483,8 +483,8 @@ nonexistent footnote: <a href="#id80" name="id81"><span class="problematic" id="
</tbody>
</table>
</div>
-<div class="section">
-<h2><a class="toc-backref" href="#id49" id="citations" name="citations">2.12&nbsp;&nbsp;&nbsp;Citations</a></h2>
+<div class="section" id="citations">
+<h2><a class="toc-backref" href="#id49">2.12&nbsp;&nbsp;&nbsp;Citations</a></h2>
<table class="docutils citation" frame="void" id="cit2002" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
@@ -495,8 +495,8 @@ rendered separately and differently from footnotes.</td></tr>
<p>Here's a reference to the above, <a class="citation-reference" href="#cit2002" id="id17" name="id17">[CIT2002]</a>, and a <a href="#id82" name="id83"><span class="problematic" id="id83"><span id="id18"></span>[nonexistent]_</span></a>
citation.</p>
</div>
-<div class="section">
-<h2><a class="toc-backref" href="#id50" id="targets" name="targets"><span id="another-target"></span>2.13&nbsp;&nbsp;&nbsp;Targets</a></h2>
+<div class="section" id="targets">
+<span id="another-target"></span><h2><a class="toc-backref" href="#id50">2.13&nbsp;&nbsp;&nbsp;Targets</a></h2>
<p id="example">This paragraph is pointed to by the explicit &quot;example&quot; target. A
reference can be found under <a class="reference" href="#inline-markup">Inline Markup</a>, above. <a class="reference" href="#inline-hyperlink-targets">Inline
hyperlink targets</a> are also possible.</p>
@@ -508,22 +508,22 @@ hyperlink targets</a> are also possible.</p>
refer to the <a class="reference" href="#id22">Targets</a> section.</p>
<p>Here's a <a href="#id84" name="id85"><span class="problematic" id="id85">`hyperlink reference without a target`_</span></a>, which generates an
error.</p>
-<div class="section">
-<h3><a class="toc-backref" href="#id51" id="duplicate-target-names" name="duplicate-target-names">2.13.1&nbsp;&nbsp;&nbsp;Duplicate Target Names</a></h3>
+<div class="section" id="duplicate-target-names">
+<h3><a class="toc-backref" href="#id51">2.13.1&nbsp;&nbsp;&nbsp;Duplicate Target Names</a></h3>
<p>Duplicate names in section headers or other implicit targets will
generate &quot;info&quot; (level-1) system messages. Duplicate names in
explicit targets will generate &quot;warning&quot; (level-2) system messages.</p>
</div>
-<div class="section">
-<h3><a class="toc-backref" href="#id52" id="id20" name="id20">2.13.2&nbsp;&nbsp;&nbsp;Duplicate Target Names</a></h3>
+<div class="section" id="id20">
+<h3><a class="toc-backref" href="#id52">2.13.2&nbsp;&nbsp;&nbsp;Duplicate Target Names</a></h3>
<p>Since there are two &quot;Duplicate Target Names&quot; section headers, we
cannot uniquely refer to either of them by name. If we try to (like
this: <a href="#id86" name="id87"><span class="problematic" id="id87">`Duplicate Target Names`_</span></a>), an error is generated.</p>
</div>
</div>
-<div class="section">
-<h2><a class="toc-backref" href="#id53" id="directives" name="directives">2.14&nbsp;&nbsp;&nbsp;Directives</a></h2>
-<div class="contents local topic">
+<div class="section" id="directives">
+<h2><a class="toc-backref" href="#id53">2.14&nbsp;&nbsp;&nbsp;Directives</a></h2>
+<div class="contents local topic" id="contents">
<ul class="auto-toc simple">
<li><a class="reference" href="#document-parts" id="id72" name="id72">2.14.1&nbsp;&nbsp;&nbsp;Document Parts</a></li>
<li><a class="reference" href="#images" id="id73" name="id73">2.14.2&nbsp;&nbsp;&nbsp;Images</a></li>
@@ -538,14 +538,14 @@ this: <a href="#id86" name="id87"><span class="problematic" id="id87">`Duplicate
<p>These are just a sample of the many reStructuredText Directives. For
others, please see
<a class="reference" href="http://docutils.sourceforge.net/docs/ref/rst/directives.html">http://docutils.sourceforge.net/docs/ref/rst/directives.html</a>.</p>
-<div class="section">
-<h3><a class="toc-backref" href="#id72" id="document-parts" name="document-parts">2.14.1&nbsp;&nbsp;&nbsp;Document Parts</a></h3>
+<div class="section" id="document-parts">
+<h3><a class="toc-backref" href="#id72">2.14.1&nbsp;&nbsp;&nbsp;Document Parts</a></h3>
<p>An example of the &quot;contents&quot; directive can be seen above this section
(a local, untitled table of <a class="reference" href="#contents">contents</a>) and at the beginning of the
document (a document-wide <a class="reference" href="#table-of-contents">table of contents</a>).</p>
</div>
-<div class="section">
-<h3><a class="toc-backref" href="#id73" id="images" name="images">2.14.2&nbsp;&nbsp;&nbsp;Images</a></h3>
+<div class="section" id="images">
+<h3><a class="toc-backref" href="#id73">2.14.2&nbsp;&nbsp;&nbsp;Images</a></h3>
<p>An image directive (also clickable -- a hyperlink reference):</p>
<a class="reference image-reference" href="#directives"><img alt="../../../docs/user/rst/images/title.png" class="class1 class2" src="../../../docs/user/rst/images/title.png" /></a>
<p>Image with multiple IDs:</p>
@@ -618,8 +618,8 @@ This is the legend.</div>
<p>An image 3 cm high:</p>
<img alt="../../../docs/user/rst/images/biohazard.png" src="../../../docs/user/rst/images/biohazard.png" style="height: 3cm;" />
</div>
-<div class="section">
-<h3><a class="toc-backref" href="#id74" id="admonitions" name="admonitions">2.14.3&nbsp;&nbsp;&nbsp;Admonitions</a></h3>
+<div class="section" id="admonitions">
+<h3><a class="toc-backref" href="#id74">2.14.3&nbsp;&nbsp;&nbsp;Admonitions</a></h3>
<div class="attention">
<p class="first admonition-title">Attention!</p>
<p class="last">Directives at large.</p>
@@ -667,8 +667,8 @@ Reader discretion is strongly advised.</p>
<p class="last">You can make up your own admonition too.</p>
</div>
</div>
-<div class="section">
-<h3><a class="toc-backref" href="#id75" id="topics-sidebars-and-rubrics" name="topics-sidebars-and-rubrics">2.14.4&nbsp;&nbsp;&nbsp;Topics, Sidebars, and Rubrics</a></h3>
+<div class="section" id="topics-sidebars-and-rubrics">
+<h3><a class="toc-backref" href="#id75">2.14.4&nbsp;&nbsp;&nbsp;Topics, Sidebars, and Rubrics</a></h3>
<div class="sidebar">
<p class="first sidebar-title">Sidebar Title</p>
<p class="sidebar-subtitle">Optional Subtitle</p>
@@ -684,8 +684,8 @@ background color.</p>
</div>
<p class="rubric">This is a rubric</p>
</div>
-<div class="section">
-<h3><a class="toc-backref" href="#id76" id="target-footnotes" name="target-footnotes">2.14.5&nbsp;&nbsp;&nbsp;Target Footnotes</a></h3>
+<div class="section" id="target-footnotes">
+<h3><a class="toc-backref" href="#id76">2.14.5&nbsp;&nbsp;&nbsp;Target Footnotes</a></h3>
<table class="docutils footnote" frame="void" id="id25" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
@@ -699,12 +699,12 @@ background color.</p>
</tbody>
</table>
</div>
-<div class="section">
-<h3><a class="toc-backref" href="#id77" id="replacement-text" name="replacement-text">2.14.6&nbsp;&nbsp;&nbsp;Replacement Text</a></h3>
+<div class="section" id="replacement-text">
+<h3><a class="toc-backref" href="#id77">2.14.6&nbsp;&nbsp;&nbsp;Replacement Text</a></h3>
<p>I recommend you try <a class="reference" href="http://www.python.org/">Python, <em>the</em> best language around</a> <a class="footnote-reference" href="#id25" id="id28" name="id28">[5]</a>.</p>
</div>
-<div class="section">
-<h3><a class="toc-backref" href="#id78" id="compound-paragraph" name="compound-paragraph">2.14.7&nbsp;&nbsp;&nbsp;Compound Paragraph</a></h3>
+<div class="section" id="compound-paragraph">
+<h3><a class="toc-backref" href="#id78">2.14.7&nbsp;&nbsp;&nbsp;Compound Paragraph</a></h3>
<div class="some-class compound">
<p class="compound-first">Compound 1, paragraph 1.</p>
<p class="compound-middle">Compound 1, paragraph 2.</p>
@@ -771,8 +771,8 @@ paragraph.</td>
<p class="compound-last">Compound 7, another paragraph.</p>
</div>
</div>
-<div class="section">
-<h3><a class="toc-backref" href="#id79" id="parsed-literal-blocks" name="parsed-literal-blocks">2.14.8&nbsp;&nbsp;&nbsp;Parsed Literal Blocks</a></h3>
+<div class="section" id="parsed-literal-blocks">
+<h3><a class="toc-backref" href="#id79">2.14.8&nbsp;&nbsp;&nbsp;Parsed Literal Blocks</a></h3>
<pre class="literal-block">
This is a parsed literal block.
This line is indented. The next line is blank.
@@ -782,13 +782,13 @@ Inline markup is supported, e.g. <em>emphasis</em>, <strong>strong</strong>, <tt
</pre>
</div>
</div>
-<div class="section">
-<h2><a class="toc-backref" href="#id62" id="substitution-definitions" name="substitution-definitions">2.15&nbsp;&nbsp;&nbsp;Substitution Definitions</a></h2>
+<div class="section" id="substitution-definitions">
+<h2><a class="toc-backref" href="#id62">2.15&nbsp;&nbsp;&nbsp;Substitution Definitions</a></h2>
<p>An inline image (<img alt="EXAMPLE" src="../../../docs/user/rst/images/biohazard.png" />) example:</p>
<p>(Substitution definitions are not visible in the HTML source.)</p>
</div>
-<div class="section">
-<h2><a class="toc-backref" href="#id63" id="comments" name="comments">2.16&nbsp;&nbsp;&nbsp;Comments</a></h2>
+<div class="section" id="comments">
+<h2><a class="toc-backref" href="#id63">2.16&nbsp;&nbsp;&nbsp;Comments</a></h2>
<p>Here's one:</p>
<!-- Comments begin with two dots and a space. Anything may
follow, except for the syntax of footnotes, hyperlink
@@ -799,21 +799,21 @@ Double-dashes - - "- -" - - must be escaped somehow in HTML output.
Comments may contain non-ASCII characters: ä ö ü æ ø å -->
<p>(View the HTML source to see the comment.)</p>
</div>
-<div class="section">
-<h2><a class="toc-backref" href="#id64" id="raw-text" name="raw-text">2.17&nbsp;&nbsp;&nbsp;Raw text</a></h2>
+<div class="section" id="raw-text">
+<h2><a class="toc-backref" href="#id64">2.17&nbsp;&nbsp;&nbsp;Raw text</a></h2>
<p>This does not necessarily look nice, because there may be missing white space.</p>
<p>It's just there to freeze the behavior.</p>
A test.Second test.<div class="myclass">Another test with myclass set.</div><p>This is the <span class="myrawroleclass">fourth test</span> with myrawroleclass set.</p>
Fifth test in HTML.<br />Line two.</div>
-<div class="section">
-<h2><a class="toc-backref" href="#id65" id="container" name="container">2.18&nbsp;&nbsp;&nbsp;Container</a></h2>
+<div class="section" id="container">
+<h2><a class="toc-backref" href="#id65">2.18&nbsp;&nbsp;&nbsp;Container</a></h2>
<div class="custom container">
<p>paragraph 1</p>
<p>paragraph 2</p>
</div>
</div>
-<div class="section">
-<h2><a class="toc-backref" href="#id66" id="colspanning-tables" name="colspanning-tables">2.19&nbsp;&nbsp;&nbsp;Colspanning tables</a></h2>
+<div class="section" id="colspanning-tables">
+<h2><a class="toc-backref" href="#id66">2.19&nbsp;&nbsp;&nbsp;Colspanning tables</a></h2>
<p>This table has a cell spanning two columns:</p>
<table border="1" class="docutils">
<colgroup>
@@ -850,8 +850,8 @@ Fifth test in HTML.<br />Line two.</div>
</tbody>
</table>
</div>
-<div class="section">
-<h2><a class="toc-backref" href="#id67" id="rowspanning-tables" name="rowspanning-tables">2.20&nbsp;&nbsp;&nbsp;Rowspanning tables</a></h2>
+<div class="section" id="rowspanning-tables">
+<h2><a class="toc-backref" href="#id67">2.20&nbsp;&nbsp;&nbsp;Rowspanning tables</a></h2>
<p>Here's a table with cells spanning several rows:</p>
<table border="1" class="docutils">
<colgroup>
@@ -883,8 +883,8 @@ cell.</td>
</tbody>
</table>
</div>
-<div class="section">
-<h2><a class="toc-backref" href="#id68" id="complex-tables" name="complex-tables">2.21&nbsp;&nbsp;&nbsp;Complex tables</a></h2>
+<div class="section" id="complex-tables">
+<h2><a class="toc-backref" href="#id68">2.21&nbsp;&nbsp;&nbsp;Complex tables</a></h2>
<p>Here's a complex table, which should test all features.</p>
<table border="1" class="docutils">
<colgroup>
@@ -932,8 +932,8 @@ empty: <tt class="docutils literal"><span class="pre">--&gt;</span></tt></td>
</tbody>
</table>
</div>
-<div class="section">
-<h2><a class="toc-backref" href="#id69" id="list-tables" name="list-tables">2.22&nbsp;&nbsp;&nbsp;List Tables</a></h2>
+<div class="section" id="list-tables">
+<h2><a class="toc-backref" href="#id69">2.22&nbsp;&nbsp;&nbsp;List Tables</a></h2>
<p>Here's a list table exercising all features:</p>
<table border="1" class="test docutils">
<caption>list table with integral header</caption>
@@ -965,8 +965,8 @@ crunchy, now would it?</td>
</tbody>
</table>
</div>
-<div class="section">
-<h2><a class="toc-backref" href="#id70" id="custom-roles" name="custom-roles">2.23&nbsp;&nbsp;&nbsp;Custom Roles</a></h2>
+<div class="section" id="custom-roles">
+<h2><a class="toc-backref" href="#id70">2.23&nbsp;&nbsp;&nbsp;Custom Roles</a></h2>
<ul>
<li><p class="first">A role based on an existing role.</p>
<p><tt class="custom docutils literal"><span class="pre">one</span></tt> <tt class="custom docutils literal"><span class="pre">two</span></tt> <tt class="custom docutils literal"><span class="pre">three</span></tt></p>
@@ -983,8 +983,8 @@ crunchy, now would it?</td>
</ul>
</div>
</div>
-<div class="section">
-<h1><a class="toc-backref" href="#id71" id="error-handling" name="error-handling">3&nbsp;&nbsp;&nbsp;Error Handling</a></h1>
+<div class="section" id="error-handling">
+<h1><a class="toc-backref" href="#id71">3&nbsp;&nbsp;&nbsp;Error Handling</a></h1>
<p>Any errors caught during processing will generate system messages.</p>
<p>There should be five messages in the following, auto-generated
section, &quot;Docutils System Messages&quot;:</p>
diff --git a/test/functional/expected/standalone_rst_s5_html_1.html b/test/functional/expected/standalone_rst_s5_html_1.html
index a3e4e4bb5..b0119ab25 100644
--- a/test/functional/expected/standalone_rst_s5_html_1.html
+++ b/test/functional/expected/standalone_rst_s5_html_1.html
@@ -68,8 +68,8 @@
============================ -->
<!-- Incremental Display
=================== -->
-<div class="contents handout topic">
-<p class="topic-title first"><a id="contents" name="contents">Contents</a></p>
+<div class="contents handout topic" id="contents">
+<p class="topic-title first">Contents</p>
<ul class="simple">
<li><a class="reference" href="#introduction" id="id1" name="id1">Introduction</a></li>
<li><a class="reference" href="#features-1" id="id2" name="id2">Features (1)</a></li>
diff --git a/test/functional/expected/standalone_rst_s5_html_2.html b/test/functional/expected/standalone_rst_s5_html_2.html
index fdf4b7ef0..6a3d72b5e 100644
--- a/test/functional/expected/standalone_rst_s5_html_2.html
+++ b/test/functional/expected/standalone_rst_s5_html_2.html
@@ -64,8 +64,8 @@
============================ -->
<!-- Incremental Display
=================== -->
-<div class="contents handout topic">
-<p class="topic-title first"><a id="contents" name="contents">Contents</a></p>
+<div class="contents handout topic" id="contents">
+<p class="topic-title first">Contents</p>
<ul class="simple">
<li><a class="reference" href="#introduction" id="id1" name="id1">Introduction</a></li>
<li><a class="reference" href="#features-1" id="id2" name="id2">Features (1)</a></li>
diff --git a/test/test_writers/test_html4css1_parts.py b/test/test_writers/test_html4css1_parts.py
index b1c6a3dbb..add7a2d39 100755
--- a/test/test_writers/test_html4css1_parts.py
+++ b/test/test_writers/test_html4css1_parts.py
@@ -118,11 +118,11 @@ And even more stuff
""",
"""\
{'fragment': '''<p>Some stuff</p>
-<div class="section">
-<h1><a id="section" name="section">Section</a></h1>
+<div class="section" id="section">
+<h1>Section</h1>
<p>Some more stuff</p>
-<div class="section">
-<h2><a id="another-section" name="another-section">Another Section</a></h2>
+<div class="section" id="another-section">
+<h2>Another Section</h2>
<p>And even more stuff</p>
</div>
</div>\\n''',
@@ -130,11 +130,11 @@ And even more stuff
<h1 class="title">Title</h1>
<h2 class="subtitle" id="subtitle">Subtitle</h2>
<p>Some stuff</p>
-<div class="section">
-<h1><a id="section" name="section">Section</a></h1>
+<div class="section" id="section">
+<h1>Section</h1>
<p>Some more stuff</p>
-<div class="section">
-<h2><a id="another-section" name="another-section">Another Section</a></h2>
+<div class="section" id="another-section">
+<h2>Another Section</h2>
<p>And even more stuff</p>
</div>
</div>
@@ -265,32 +265,32 @@ Another Section
And even more stuff
""",
"""\
-{'fragment': '''<div class="section">
-<h1><a id="title" name="title">Title</a></h1>
-<div class="section">
-<h2><a id="not-a-subtitle" name="not-a-subtitle">Not A Subtitle</a></h2>
+{'fragment': '''<div class="section" id="title">
+<h1>Title</h1>
+<div class="section" id="not-a-subtitle">
+<h2>Not A Subtitle</h2>
<p>Some stuff</p>
-<div class="section">
-<h3><a id="section" name="section">Section</a></h3>
+<div class="section" id="section">
+<h3>Section</h3>
<p>Some more stuff</p>
-<div class="section">
-<h4><a id="another-section" name="another-section">Another Section</a></h4>
+<div class="section" id="another-section">
+<h4>Another Section</h4>
<p>And even more stuff</p>
</div>
</div>
</div>
</div>\\n''',
'html_body': '''<div class="document">
-<div class="section">
-<h1><a id="title" name="title">Title</a></h1>
-<div class="section">
-<h2><a id="not-a-subtitle" name="not-a-subtitle">Not A Subtitle</a></h2>
+<div class="section" id="title">
+<h1>Title</h1>
+<div class="section" id="not-a-subtitle">
+<h2>Not A Subtitle</h2>
<p>Some stuff</p>
-<div class="section">
-<h3><a id="section" name="section">Section</a></h3>
+<div class="section" id="section">
+<h3>Section</h3>
<p>Some more stuff</p>
-<div class="section">
-<h4><a id="another-section" name="another-section">Another Section</a></h4>
+<div class="section" id="another-section">
+<h4>Another Section</h4>
<p>And even more stuff</p>
</div>
</div>
diff --git a/test/test_writers/test_html4css1_template.py b/test/test_writers/test_html4css1_template.py
index 6df069688..98714fde6 100755
--- a/test/test_writers/test_html4css1_template.py
+++ b/test/test_writers/test_html4css1_template.py
@@ -81,8 +81,8 @@ docinfo = """\
body = """\
-<div class="section">
-<h1><a id="section" name="section">Section</a></h1>
+<div class="section" id="section">
+<h1>Section</h1>
<p>Some text.</p>
</div>"""
@@ -138,8 +138,8 @@ docinfo = """\
body = """\
-<div class="section">
-<h1><a id="section" name="section">Section</a></h1>
+<div class="section" id="section">
+<h1>Section</h1>
<p>Some text.</p>
</div>"""
@@ -180,8 +180,8 @@ meta = """\
fragment = """\
-<div class="section">
-<h1><a id="section" name="section">Section</a></h1>
+<div class="section" id="section">
+<h1>Section</h1>
<p>Some text.</p>
</div>"""
@@ -218,8 +218,8 @@ html_body = """\
<td>Me</td></tr>
</tbody>
</table>
-<div class="section">
-<h1><a id="section" name="section">Section</a></h1>
+<div class="section" id="section">
+<h1>Section</h1>
<p>Some text.</p>
</div>
</div>