From: <fel...@us...> - 2005-06-06 01:20:58
|
Author: felixwiemann Date: 2005-06-06 03:20:35 +0200 (Mon, 06 Jun 2005) New Revision: 3439 Modified: trunk/docutils/docutils/parsers/rst/directives/parts.py trunk/docutils/docutils/writers/latex2e.py trunk/docutils/test/functional/expected/standalone_rst_html4css1.html trunk/docutils/test/functional/expected/standalone_rst_pseudoxml.txt trunk/docutils/test/test_parsers/test_rst/test_directives/test_contents.py trunk/docutils/test/test_transforms/test_contents.py Log: added "local" class to local TOCs Modified: trunk/docutils/docutils/parsers/rst/directives/parts.py =================================================================== --- trunk/docutils/docutils/parsers/rst/directives/parts.py 2005-06-05 23:05:51 UTC (rev 3438) +++ trunk/docutils/docutils/parsers/rst/directives/parts.py 2005-06-06 01:20:35 UTC (rev 3439) @@ -56,6 +56,8 @@ title = nodes.title('', language.labels['contents']) topic = nodes.topic(classes=['contents']) topic['classes'] += options.get('class', []) + if options.has_key('local'): + topic['classes'].append('local') if title: name = title.astext() topic += title Modified: trunk/docutils/docutils/writers/latex2e.py =================================================================== --- trunk/docutils/docutils/writers/latex2e.py 2005-06-05 23:05:51 UTC (rev 3438) +++ trunk/docutils/docutils/writers/latex2e.py 2005-06-06 01:20:35 UTC (rev 3439) @@ -946,14 +946,14 @@ self.body.append( '\\end{quote}\n') def visit_bullet_list(self, node): - if self.topic_classes == ['contents']: + if 'contents' in self.topic_classes: if not self.use_latex_toc: self.body.append( '\\begin{list}{}{}\n' ) else: self.body.append( '\\begin{itemize}\n' ) def depart_bullet_list(self, node): - if self.topic_classes == ['contents']: + if 'contents' in self.topic_classes: if not self.use_latex_toc: self.body.append( '\\end{list}\n' ) else: @@ -1708,7 +1708,7 @@ def visit_paragraph(self, node): index = node.parent.index(node) - if not (self.topic_classes == ['contents'] or + if not ('contents' in self.topic_classes or (isinstance(node.parent, nodes.compound) and index > 0 and not isinstance(node.parent[index - 1], nodes.paragraph) and Modified: trunk/docutils/test/functional/expected/standalone_rst_html4css1.html =================================================================== --- trunk/docutils/test/functional/expected/standalone_rst_html4css1.html 2005-06-05 23:05:51 UTC (rev 3438) +++ trunk/docutils/test/functional/expected/standalone_rst_html4css1.html 2005-06-06 01:20:35 UTC (rev 3439) @@ -522,7 +522,7 @@ </div> <div class="section" id="directives"> <h2><a class="toc-backref" href="#id46" name="directives">2.14 Directives</a></h2> -<div class="contents topic" id="contents"> +<div class="contents local topic" id="contents"> <ul class="auto-toc simple"> <li><a class="reference" href="#document-parts" id="id62" name="id62">2.14.1 Document Parts</a></li> <li><a class="reference" href="#images" id="id63" name="id63">2.14.2 Images</a></li> Modified: trunk/docutils/test/functional/expected/standalone_rst_pseudoxml.txt =================================================================== --- trunk/docutils/test/functional/expected/standalone_rst_pseudoxml.txt 2005-06-05 23:05:51 UTC (rev 3438) +++ trunk/docutils/test/functional/expected/standalone_rst_pseudoxml.txt 2005-06-06 01:20:35 UTC (rev 3439) @@ -1048,7 +1048,7 @@ <generated classes="sectnum"> 2.14 Directives - <topic classes="contents" ids="contents" names="contents"> + <topic classes="contents local" ids="contents" names="contents"> <bullet_list classes="auto-toc"> <list_item> <paragraph> Modified: trunk/docutils/test/test_parsers/test_rst/test_directives/test_contents.py =================================================================== --- trunk/docutils/test/test_parsers/test_rst/test_directives/test_contents.py 2005-06-05 23:05:51 UTC (rev 3438) +++ trunk/docutils/test/test_parsers/test_rst/test_directives/test_contents.py 2005-06-06 01:20:35 UTC (rev 3439) @@ -101,7 +101,7 @@ """, """\ <document source="test data"> - <topic classes="contents" ids="contents" names="contents"> + <topic classes="contents local" ids="contents" names="contents"> <pending> .. internal attributes: .transform: docutils.transforms.parts.Contents @@ -132,7 +132,7 @@ """, """\ <document source="test data"> - <topic classes="contents" ids="table-of-contents" names="table of contents"> + <topic classes="contents local" ids="table-of-contents" names="table of contents"> <title> Table of Contents <pending> Modified: trunk/docutils/test/test_transforms/test_contents.py =================================================================== --- trunk/docutils/test/test_transforms/test_contents.py 2005-06-05 23:05:51 UTC (rev 3438) +++ trunk/docutils/test/test_transforms/test_contents.py 2005-06-06 01:20:35 UTC (rev 3439) @@ -258,7 +258,7 @@ <section ids="title-1" names="title 1"> <title> Title 1 - <topic classes="contents" ids="contents" names="contents"> + <topic classes="contents local" ids="contents" names="contents"> <bullet_list> <list_item> <paragraph> @@ -303,7 +303,7 @@ """, """\ <document source="test data"> - <topic classes="contents" ids="contents" names="contents"> + <topic classes="contents local" ids="contents" names="contents"> <bullet_list> <list_item> <paragraph> @@ -404,7 +404,7 @@ <sidebar> <title> Contents - <topic classes="contents" ids="contents" names="contents"> + <topic classes="contents local" ids="contents" names="contents"> <bullet_list> <list_item> <paragraph> |