Commits

Georg Brandl committed b2f5620

Handle inline nodes in latex and text writers.

Comments (0)

Files changed (3)

sphinx/latexwriter.py

     def visit_substitution_reference(self, node):
         raise nodes.SkipNode
 
+    def visit_inline(self, node):
+        classes = node.get('classes', [])
+        self.body.append(r'\DUspan{%s}{' %','.join(classes))
+    def depart_inline(self, node):
+        self.body.append('}')
+
     def visit_generated(self, node):
         pass
     def depart_generated(self, node):

sphinx/texinputs/sphinx.sty

                 linkcolor=InnerLinkColor,filecolor=OuterLinkColor,
                 menucolor=OuterLinkColor,pagecolor=OuterLinkColor,
                 urlcolor=OuterLinkColor]{hyperref}
+
+% From docutils.writers.latex2e
+\providecommand{\DUspan}[2]{%
+  {% group ("span") to limit the scope of styling commands
+    \@for\node@class@name:=#1\do{%
+    \ifcsname docutilsrole\node@class@name\endcsname%
+      \csname docutilsrole\node@class@name\endcsname%
+    \fi%
+    }%
+    {#2}% node content
+  }% close "span"
+}

sphinx/textwriter.py

     def depart_Text(self, node):
         pass
 
+    def visit_generated(self, node):
+        pass
+    def depart_generated(self, node):
+        pass
+
+    def visit_inline(self, node):
+        pass
+    def depart_inline(self, node):
+        pass
+
     def visit_problematic(self, node):
         self.add_text('>>')
     def depart_problematic(self, node):