Georg Brandl avatar 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):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.