Commits

Georg Brandl committed a68d4dc

Implement missing node handlers for texinfo. Enable checking warnings from texinfo build in tests.

Comments (0)

Files changed (3)

sphinx/ext/mathbase.py

 from docutils import nodes, utils
 from docutils.parsers.rst import directives
 
+from sphinx.writers import texinfo
 from sphinx.util.compat import Directive
-from sphinx.writers.texinfo import escape
 
 
 class math(nodes.Inline, nodes.TextElement):
 
 
 def texinfo_visit_math(self, node):
-    self.body.append('@math{' + escape(node['latex']) + '}')
+    self.body.append('@math{' + texinfo.escape_arg(node['latex']) + '}')
     raise nodes.SkipNode
 
 def texinfo_visit_displaymath(self, node):

sphinx/writers/texinfo.py

 
         self.short_ids = {}
         self.body = []
+        self.context = []
         self.previous_section = None
         self.section_level = 0
         self.seen_title = False
         self.add_text("", fresh=1)
     def depart_desc_content(self, node):
         pass
+
+    def visit_inline(self, node):
+        # stub
+        pass
+    def depart_inline(self, node):
+        pass
+
+    def visit_abbreviation(self, node):
+        self.add_text('@abbr{')
+        if node.hasattr('explanation'):
+            self.context.append(', %s}' % escape_arg(node['explanation']))
+        else:
+            self.context.append('}')
+    def depart_abbreviation(self, node):
+        self.body.append(self.context.pop())
+
+    def visit_download_reference(self, node):
+        pass
+    def depart_download_reference(self, node):
+        pass
+
+    def visit_hlist(self, node):
+        # stub
+        self.visit_bullet_list(node)
+    def depart_hlist(self, node):
+        self.depart_bullet_list(node)
+
+    def visit_hlistcol(self, node):
+        pass
+    def depart_hlistcol(self, node):
+        pass

tests/test_build_texinfo.py

     app.builder.build_all()
     texinfo_warnings = texinfo_warnfile.getvalue().replace(os.sep, '/')
     texinfo_warnings_exp = TEXINFO_WARNINGS % {'root': app.srcdir}
-    #assert re.match(texinfo_warnings_exp + '$', texinfo_warnings), \
-    #       'Warnings don\'t match:\n' + \
-    #       '--- Expected (regex):\n' + texinfo_warnings_exp + \
-    #       '--- Got:\n' + texinfo_warnings
+    assert re.match(texinfo_warnings_exp + '$', texinfo_warnings), \
+           'Warnings don\'t match:\n' + \
+           '--- Expected (regex):\n' + texinfo_warnings_exp + \
+           '--- Got:\n' + texinfo_warnings
     # now, try to run makeinfo over it
     cwd = os.getcwd()
     os.chdir(app.outdir)
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.