Test suite update for math extension.

This commit is contained in:
Georg Brandl 2008-08-06 14:57:44 +00:00
parent 26d724cb6d
commit 6d89feae1e
5 changed files with 30 additions and 6 deletions

View File

@ -63,7 +63,7 @@ further translation is necessary when building LaTeX output.
to be issued. See :role:`eqref` for an example. The numbering style depends to be issued. See :role:`eqref` for an example. The numbering style depends
on the output format. on the output format.
.. role:: eqref .. role:: eq
Role for cross-referencing equations via their label. This currently works Role for cross-referencing equations via their label. This currently works
only within the same document. Example:: only within the same document. Example::
@ -71,7 +71,7 @@ further translation is necessary when building LaTeX output.
.. math:: e^{i\pi} + 1 = 0 .. math:: e^{i\pi} + 1 = 0
:label: euler :label: euler
Euler's identity, equation :eqref:`euler`, was elected one of the most Euler's identity, equation :eq:`euler`, was elected one of the most
beautiful mathematical formulas. beautiful mathematical formulas.

View File

@ -67,8 +67,8 @@ def latex_visit_math(self, node):
raise nodes.SkipNode raise nodes.SkipNode
def latex_visit_displaymath(self, node): def latex_visit_displaymath(self, node):
self.body.append(wrap_displaymath(node['latex'], label = node['label'] and node['docname'] + '-' + node['label'] or None
node['docname'] + '-' + node['label'])) self.body.append(wrap_displaymath(node['latex'], label))
raise nodes.SkipNode raise nodes.SkipNode
def latex_visit_eqref(self, node): def latex_visit_eqref(self, node):
@ -87,7 +87,7 @@ def text_visit_displaymath(self, node):
raise nodes.SkipNode raise nodes.SkipNode
def text_visit_eqref(self, node): def text_visit_eqref(self, node):
self.add_text(node['label']) self.add_text(node['target'])
raise nodes.SkipNode raise nodes.SkipNode

View File

@ -23,7 +23,8 @@ sys.path.append(os.path.abspath('.'))
# Add any Sphinx extension module names here, as strings. They can be extensions # Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['ext', 'sphinx.ext.autodoc'] extensions = ['ext', 'sphinx.ext.autodoc', 'sphinx.ext.jsmath']
jsmath_path = 'dummy.js'
# Add any paths that contain templates here, relative to this directory. # Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates'] templates_path = ['_templates']

View File

@ -13,6 +13,7 @@ Contents:
images images
includes includes
markup markup
math
Indices and tables Indices and tables
================== ==================

22
tests/root/math.txt Normal file
View File

@ -0,0 +1,22 @@
Test math extensions
====================
This is inline math: :math:`a^2 + b^2 = c^2`.
.. math:: a^2 + b^2 = c^2
.. math::
a^2 + b^2 = c^2
.. math::
:label: foo
e^{i\pi} = 1
.. math::
:label:
e^{ix} = \cos x + i\sin x
Referencing equation :eq:`foo`.