[Python-checkins] r59534 - doctools/trunk/sphinx/latexwriter.py

georg.brandl python-checkins at python.org
Sun Dec 16 22:55:57 CET 2007


Author: georg.brandl
Date: Sun Dec 16 22:55:57 2007
New Revision: 59534

Modified:
   doctools/trunk/sphinx/latexwriter.py
Log:
Implement sidebar and topic nodes.


Modified: doctools/trunk/sphinx/latexwriter.py
==============================================================================
--- doctools/trunk/sphinx/latexwriter.py	(original)
+++ doctools/trunk/sphinx/latexwriter.py	Sun Dec 16 22:55:57 2007
@@ -155,15 +155,17 @@
         self.sectionlevel -= 1
 
     def visit_problematic(self, node):
-        self.body.append('{\\color{red}\\bfseries{}')
+        self.body.append(r'{\color{red}\bfseries{}')
     def depart_problematic(self, node):
         self.body.append('}')
 
     def visit_topic(self, node):
-        raise nodes.SkipNode # XXX
-
-    def visit_sidebar(self, node):
-        raise nodes.SkipNode # XXX
+        self.body.append('\\begin{center}\\setlength{\\fboxsep}{5pt}'
+                         '\\fbox{\\begin{minipage}{0.95\\textwidth}\n')
+    def depart_topic(self, node):
+        self.body.append('\end{minipage}}\\end{center}\n')
+    visit_sidebar = visit_topic
+    depart_sidebar = depart_topic
 
     def visit_glossary(self, node):
         pass
@@ -203,6 +205,9 @@
         elif isinstance(node.parent, nodes.section):
             self.body.append(r'\%s{' % self.sectionnames[self.sectionlevel])
             self.context.append('}\n')
+        elif isinstance(node.parent, (nodes.topic, nodes.sidebar)):
+            self.body.append(r'\textbf{')
+            self.context.append('}\n\n\medskip\n\n')
         else:
             raise RuntimeError("XXX title without section")
         self.in_title = 1


More information about the Python-checkins mailing list