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

This commit is contained in:
Georg Brandl 2010-10-22 11:27:33 +02:00
parent c48b67d3c9
commit 08c1076917
3 changed files with 38 additions and 6 deletions

View File

@ -12,8 +12,8 @@
from docutils import nodes, utils from docutils import nodes, utils
from docutils.parsers.rst import directives from docutils.parsers.rst import directives
from sphinx.writers import texinfo
from sphinx.util.compat import Directive from sphinx.util.compat import Directive
from sphinx.writers.texinfo import escape
class math(nodes.Inline, nodes.TextElement): class math(nodes.Inline, nodes.TextElement):
@ -124,7 +124,7 @@ def man_visit_eqref(self, node):
def texinfo_visit_math(self, node): 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 raise nodes.SkipNode
def texinfo_visit_displaymath(self, node): def texinfo_visit_displaymath(self, node):

View File

@ -175,6 +175,7 @@ class TexinfoTranslator(nodes.NodeVisitor):
self.short_ids = {} self.short_ids = {}
self.body = [] self.body = []
self.context = []
self.previous_section = None self.previous_section = None
self.section_level = 0 self.section_level = 0
self.seen_title = False self.seen_title = False
@ -1183,3 +1184,34 @@ class TexinfoTranslator(nodes.NodeVisitor):
self.add_text("", fresh=1) self.add_text("", fresh=1)
def depart_desc_content(self, node): def depart_desc_content(self, node):
pass 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

View File

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