mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Implement missing node handlers for texinfo. Enable checking warnings from texinfo build in tests.
This commit is contained in:
parent
c48b67d3c9
commit
08c1076917
@ -12,8 +12,8 @@
|
||||
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):
|
||||
@ -124,7 +124,7 @@ def man_visit_eqref(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
|
||||
|
||||
def texinfo_visit_displaymath(self, node):
|
||||
|
@ -175,6 +175,7 @@ class TexinfoTranslator(nodes.NodeVisitor):
|
||||
|
||||
self.short_ids = {}
|
||||
self.body = []
|
||||
self.context = []
|
||||
self.previous_section = None
|
||||
self.section_level = 0
|
||||
self.seen_title = False
|
||||
@ -1183,3 +1184,34 @@ class TexinfoTranslator(nodes.NodeVisitor):
|
||||
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
|
||||
|
@ -36,10 +36,10 @@ def test_texinfo(app):
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user