[Python-checkins] r67071 - in doctools/trunk: sphinx/latexwriter.py sphinx/textwriter.py tests/root/markup.txt

georg.brandl python-checkins at python.org
Sat Nov 1 15:40:03 CET 2008


Author: georg.brandl
Date: Sat Nov  1 15:40:02 2008
New Revision: 67071

Log:
Improve node coverage for latex/text writers.


Modified:
   doctools/trunk/sphinx/latexwriter.py
   doctools/trunk/sphinx/textwriter.py
   doctools/trunk/tests/root/markup.txt

Modified: doctools/trunk/sphinx/latexwriter.py
==============================================================================
--- doctools/trunk/sphinx/latexwriter.py	(original)
+++ doctools/trunk/sphinx/latexwriter.py	Sat Nov  1 15:40:02 2008
@@ -358,6 +358,15 @@
         self.in_title = 0
         self.body.append(self.context.pop())
 
+    def visit_subtitle(self, node):
+        if isinstance(node.parent, nodes.sidebar):
+            self.body.append('~\\\\\n\\textbf{')
+            self.context.append('}\n\\smallskip\n')
+        else:
+            self.context.append('')
+    def depart_subtitle(self, node):
+        self.body.append(self.context.pop())
+
     desc_map = {
         'function' : 'funcdesc',
         'class': 'classdesc',

Modified: doctools/trunk/sphinx/textwriter.py
==============================================================================
--- doctools/trunk/sphinx/textwriter.py	(original)
+++ doctools/trunk/sphinx/textwriter.py	Sat Nov  1 15:40:02 2008
@@ -126,6 +126,16 @@
         self.add_text(' ]-')
         self.end_state()
 
+    def visit_sidebar(self, node):
+        pass
+    def depart_sidebar(self, node):
+        pass
+
+    def visit_compound(self, node):
+        pass
+    def depart_compound(self, node):
+        pass
+
     def visit_glossary(self, node):
         pass
     def depart_glossary(self, node):
@@ -145,6 +155,16 @@
         self.stateindent.pop()
         self.states[-1].append((0, ['', text, '%s' % (char * len(text)), '']))
 
+    def visit_subtitle(self, node):
+        pass
+    def depart_subtitle(self, node):
+        pass
+
+    def visit_attribution(self, node):
+        self.add_text('-- ')
+    def depart_attribution(self, node):
+        pass
+
     def visit_module(self, node):
         if node.has_key('platform'):
             self.new_state(0)

Modified: doctools/trunk/tests/root/markup.txt
==============================================================================
--- doctools/trunk/tests/root/markup.txt	(original)
+++ doctools/trunk/tests/root/markup.txt	Sat Nov  1 15:40:02 2008
@@ -31,6 +31,41 @@
    Tip text.
 
 
+Body directives
+---------------
+
+.. topic:: Title
+
+   Topic body.
+
+.. sidebar:: Sidebar
+   :subtitle: Sidebar subtitle
+
+   Sidebar body.
+
+.. rubric:: Test rubric
+
+.. epigraph:: Epigraph title
+
+   Epigraph body.
+
+   -- Author
+
+.. highlights:: Highlights
+
+   Highlights body.
+
+.. pull-quote:: Pull-quote
+
+   Pull quote body.
+
+.. compound::
+
+   a
+
+   b
+
+   
 Tables
 ------
 


More information about the Python-checkins mailing list