Author: felixwiemann
Date: 2005-04-27 13:50:29 +0200 (Wed, 27 Apr 2005)
New Revision: 3262
Modified:
trunk/docutils/docutils/writers/html4css1.py
trunk/docutils/test/functional/expected/standalone_rst_html4css1.html
Log:
do not add first/last class to invisible elements
Modified: trunk/docutils/docutils/writers/html4css1.py
===================================================================
--- trunk/docutils/docutils/writers/html4css1.py 2005-04-27 11:44:59 UTC (rev 3261)
+++ trunk/docutils/docutils/writers/html4css1.py 2005-04-27 11:50:29 UTC (rev 3262)
@@ -338,9 +338,10 @@
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()
Modified: trunk/docutils/test/functional/expected/standalone_rst_html4css1.html
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_html4css1.html 2005-04-27 11:44:59 UTC (rev 3261)
+++ trunk/docutils/test/functional/expected/standalone_rst_html4css1.html 2005-04-27 11:50:29 UTC (rev 3262)
@@ -617,7 +617,7 @@
</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">
|