diff options
| author | milde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2015-04-12 10:06:43 +0000 |
|---|---|---|
| committer | milde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2015-04-12 10:06:43 +0000 |
| commit | 35e3e04aa6c0ef61bc9bddadd39a1519d55bb233 (patch) | |
| tree | a66352250a2dc58e7813420c4b83e6f5c15b1c2c /docutils/utils | |
| parent | 11e31421d5f6bf5b2b6068d2e3c4e0b87904a003 (diff) | |
| download | docutils-35e3e04aa6c0ef61bc9bddadd39a1519d55bb233.tar.gz | |
Small HTML fixes and documentation updates.
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@7865 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'docutils/utils')
| -rw-r--r-- | docutils/utils/math/__init__.py | 5 | ||||
| -rw-r--r-- | docutils/utils/math/latex2mathml.py | 11 |
2 files changed, 14 insertions, 2 deletions
diff --git a/docutils/utils/math/__init__.py b/docutils/utils/math/__init__.py index 4c38a1e86..d9d19570b 100644 --- a/docutils/utils/math/__init__.py +++ b/docutils/utils/math/__init__.py @@ -17,8 +17,9 @@ It contains various modules for conversion between different math formats :math2html: LaTeX math -> HTML conversion from eLyXer :latex2mathml: LaTeX math -> presentational MathML -:unichar2tex: Unicode character to LaTeX math translation table -:tex2unichar: LaTeX math to Unicode character translation dictionaries +:unichar2tex: Unicode character to LaTeX math translation table +:tex2unichar: LaTeX math to Unicode character translation dictionaries +:tex2mathml_extern: Wrapper for TeX -> MathML command line converters """ # helpers for Docutils math support diff --git a/docutils/utils/math/latex2mathml.py b/docutils/utils/math/latex2mathml.py index 4c2980574..c0f233178 100644 --- a/docutils/utils/math/latex2mathml.py +++ b/docutils/utils/math/latex2mathml.py @@ -558,3 +558,14 @@ def handle_keyword(name, node, string): raise SyntaxError(u'Unknown LaTeX command: ' + name) return node, skip + +def tex2mathml(tex_math, inline=True): + """Return string with MathML code corresponding to `tex_math`. + + `inline`=True is for inline math and `inline`=False for displayed math. + """ + + mathml_tree = parse_latex_math(tex_math, inline=inline) + return ''.join(mathml_tree.xml()) + + |
