Commits

Georg Brandl committed a68d4dc

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

  • Participants
  • Parent commits 5b184b3

Comments (0)

Files changed (3)

File 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):

File 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

File 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)