X-Git-Url: https://git.mdrn.pl/librarian.git/blobdiff_plain/fefdce4e24f9e397df5538fe6e7f54b5ece4d841..e31846b5146f144013121af2112f1ce62c226bc8:/src/librarian/embeds/mathml.py?ds=sidebyside diff --git a/src/librarian/embeds/mathml.py b/src/librarian/embeds/mathml.py index 564a9f4..16fa75b 100644 --- a/src/librarian/embeds/mathml.py +++ b/src/librarian/embeds/mathml.py @@ -11,16 +11,21 @@ class MathML(TreeEmbed): @downgrades_to('application/x-latex') def to_latex(self): """ - >>> print(MathML(etree.fromstring('a < b')).to_latex().data.strip()) + >>> print(MathML(etree.fromstring( + ... 'a < b' + ... )).to_latex().data.strip()) a < b - >>> print(MathML(etree.fromstring('< & &lt; A')).to_latex().data.strip()) + >>> print(MathML(etree.fromstring( + ... '< & &lt; A' + ... )).to_latex().data.strip()) < & < A """ xslt = etree.parse(get_resource('res/embeds/mathml/mathml2latex.xslt')) output = self.tree.xslt(xslt) text = six.text_type(output) - # Workaround for entities being preserved in output. But there should be a better way. + # Workaround for entities being preserved in output. + # But there should be a better way. text = text.replace('<', '<').replace('&', '&') return create_embed('application/x-latex', data=text)