summaryrefslogtreecommitdiff
path: root/docutils
diff options
context:
space:
mode:
authorwiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2005-05-29 12:42:43 +0000
committerwiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2005-05-29 12:42:43 +0000
commitbb008d4df35ab1b443a32cf5aca07dc769a5313c (patch)
tree686f1ee62048a668b4803e930264c71ae9c1805d /docutils
parentff8b84e224ce7be71c0e27b4d7a8bf2760e36592 (diff)
downloaddocutils-bb008d4df35ab1b443a32cf5aca07dc769a5313c.tar.gz
moved aux. <span> tags for multiple IDs *inside* the element which carries the ID
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@3409 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'docutils')
-rw-r--r--docutils/docutils/writers/html4css1.py16
-rw-r--r--docutils/test/functional/expected/standalone_rst_html4css1.html10
2 files changed, 16 insertions, 10 deletions
diff --git a/docutils/docutils/writers/html4css1.py b/docutils/docutils/writers/html4css1.py
index 1a7d44f0a..22eedf4f3 100644
--- a/docutils/docutils/writers/html4css1.py
+++ b/docutils/docutils/writers/html4css1.py
@@ -7,10 +7,10 @@
"""
Simple HyperText Markup Language document tree Writer.
-The output conforms to the HTML 4.01 Transitional DTD and to the Extensible
-HTML version 1.0 Transitional DTD (*almost* strict). The output contains a
-minimum of formatting information. A cascading style sheet ("default.css" by
-default) is required for proper viewing with a modern graphical browser.
+The output conforms to the XHTML version 1.0 Transitional DTD
+(*almost* strict). The output contains a minimum of formatting
+information. A cascading style sheet ("default.css" by default) is
+required for proper viewing with a modern graphical browser.
"""
__docformat__ = 'reStructuredText'
@@ -311,7 +311,13 @@ class HTMLTranslator(nodes.NodeVisitor):
if node.get('ids'):
atts['id'] = node['ids'][0]
for id in node['ids'][1:]:
- prefix.append('<span id="%s"></span>' % id)
+ if infix:
+ # Empty tag.
+ prefix.append('<span id="%s"></span>' % id)
+ else:
+ # Non-empty tag. We place the auxiliary <span>
+ # tag *inside* the element.
+ suffix += '<span id="%s"></span>' % id
if atts.has_key('id') and tagname in self.named_tags:
atts['name'] = atts['id'] # for compatibility with old browsers
attlist = atts.items()
diff --git a/docutils/test/functional/expected/standalone_rst_html4css1.html b/docutils/test/functional/expected/standalone_rst_html4css1.html
index f0ec8afb2..928fb8801 100644
--- a/docutils/test/functional/expected/standalone_rst_html4css1.html
+++ b/docutils/test/functional/expected/standalone_rst_html4css1.html
@@ -21,9 +21,9 @@
Document header
<hr class="header"/>
</div>
-<span id="doctitle"></span><div class="document" id="restructuredtext-test-document">
-<h1 class="title">reStructuredText Test Document</h1>
-<span id="subtitle"></span><h2 class="subtitle" id="examples-of-syntax-constructs">Examples of Syntax Constructs</h2>
+<div class="document" id="restructuredtext-test-document">
+<span id="doctitle"></span><h1 class="title">reStructuredText Test Document</h1>
+<h2 class="subtitle" id="examples-of-syntax-constructs"><span id="subtitle"></span>Examples of Syntax Constructs</h2>
<table class="docinfo" frame="void" rules="none">
<col class="docinfo-name" />
<col class="docinfo-content" />
@@ -494,8 +494,8 @@ rendered separately and differently from footnotes.</td></tr>
<p>Here's a reference to the above, <a class="citation-reference" href="#cit2002" id="id15" name="id15">[CIT2002]</a>, and a <a href="#id71" name="id72"><span class="problematic" id="id72">[nonexistent]_</span></a>
citation.</p>
</div>
-<span id="another-target"></span><div class="section" id="targets">
-<h2><a class="toc-backref" href="#id43" name="targets">2.13&nbsp;&nbsp;&nbsp;Targets</a></h2>
+<div class="section" id="targets">
+<span id="another-target"></span><h2><a class="toc-backref" href="#id43" name="targets">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>