summaryrefslogtreecommitdiff
path: root/docutils
diff options
context:
space:
mode:
authorwiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2005-04-27 11:50:29 +0000
committerwiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2005-04-27 11:50:29 +0000
commit58c0c6f492f4a4b46cf860e63b1f8935f43eecdb (patch)
tree886be0e5a4ed90feb6b7602c6284d0e02b1718c2 /docutils
parent84bda23dee8d8eba3f0915152f294a79d4a2aef8 (diff)
downloaddocutils-58c0c6f492f4a4b46cf860e63b1f8935f43eecdb.tar.gz
do not add first/last class to invisible elements
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@3262 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'docutils')
-rw-r--r--docutils/docutils/writers/html4css1.py7
-rw-r--r--docutils/test/functional/expected/standalone_rst_html4css1.html2
2 files changed, 5 insertions, 4 deletions
diff --git a/docutils/docutils/writers/html4css1.py b/docutils/docutils/writers/html4css1.py
index 76499dea6..9323565d7 100644
--- a/docutils/docutils/writers/html4css1.py
+++ b/docutils/docutils/writers/html4css1.py
@@ -338,9 +338,10 @@ class HTMLTranslator(nodes.NodeVisitor):
return self.starttag(node, tagname, suffix, infix=' /', **attributes)
def set_first_last(self, node):
- if len(node):
- node[0]['classes'].append('first')
- node[-1]['classes'].append('last')
+ children = [n for n in node if not isinstance(n, nodes.Invisible)]
+ if children:
+ children[0]['classes'].append('first')
+ children[-1]['classes'].append('last')
def visit_Text(self, node):
text = node.astext()
diff --git a/docutils/test/functional/expected/standalone_rst_html4css1.html b/docutils/test/functional/expected/standalone_rst_html4css1.html
index e4067e2eb..13f8c02c6 100644
--- a/docutils/test/functional/expected/standalone_rst_html4css1.html
+++ b/docutils/test/functional/expected/standalone_rst_html4css1.html
@@ -617,7 +617,7 @@ Reader discretion is strongly advised.</p>
</div>
<div class="admonition-and-by-the-way admonition">
<p class="first admonition-title">And, by the way...</p>
-<p>You can make up your own admonition too.</p>
+<p class="last">You can make up your own admonition too.</p>
</div>
</div>
<div class="section" id="topics-sidebars-and-rubrics">