summaryrefslogtreecommitdiff
path: root/sphinx/ext/mathbase.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-03-01 10:09:14 +0100
committerGeorg Brandl <georg@python.org>2010-03-01 10:09:14 +0100
commit029e89e50216d7e0e8945f9773cf7c476ac3e663 (patch)
treee965c65fab77faacd6f92af9b8a6d3a3fe13b960 /sphinx/ext/mathbase.py
parent8d003c551567c201b2ac65a602cf3631abedd6a0 (diff)
downloadsphinx-029e89e50216d7e0e8945f9773cf7c476ac3e663.tar.gz
Add more visitors for manpage writer.
Diffstat (limited to 'sphinx/ext/mathbase.py')
-rw-r--r--sphinx/ext/mathbase.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/sphinx/ext/mathbase.py b/sphinx/ext/mathbase.py
index 774f5608..8a5b75d3 100644
--- a/sphinx/ext/mathbase.py
+++ b/sphinx/ext/mathbase.py
@@ -108,6 +108,20 @@ def text_visit_eqref(self, node):
raise nodes.SkipNode
+def man_visit_math(self, node):
+ self.body.append(node['latex'])
+ raise nodes.SkipNode
+
+def man_visit_displaymath(self, node):
+ self.visit_centered(node)
+def man_depart_displaymath(self, node):
+ self.depart_centered(node)
+
+def man_visit_eqref(self, node):
+ self.body.append(node['target'])
+ raise nodes.SkipNode
+
+
def html_visit_eqref(self, node):
self.body.append('<a href="#equation-%s">' % node['target'])
@@ -136,14 +150,17 @@ def setup_math(app, htmlinlinevisitors, htmldisplayvisitors):
app.add_node(math,
latex=(latex_visit_math, None),
text=(text_visit_math, None),
+ man=(man_visit_math, None),
html=htmlinlinevisitors)
app.add_node(displaymath,
latex=(latex_visit_displaymath, None),
text=(text_visit_displaymath, None),
+ man=(man_visit_displaymath, man_depart_displaymath),
html=htmldisplayvisitors)
app.add_node(eqref,
latex=(latex_visit_eqref, None),
text=(text_visit_eqref, None),
+ man=(man_visit_eqref, None),
html=(html_visit_eqref, html_depart_eqref))
app.add_role('math', math_role)
app.add_role('eq', eq_role)