f99f9796a55694ea27ffc41d66c4be6e986369d2
[librarian.git] / librarian / embeds / mathml.py
1 from lxml import etree
2 from librarian import get_resource
3 from . import TreeEmbed, create_embed, downgrades_to, converts_to
4
5 class MathML(TreeEmbed):
6     @downgrades_to('application/x-latex')
7     def to_latex(self):
8         xslt = etree.parse(get_resource('res/embeds/mathml/mathml2latex.xslt'))
9         output = self.tree.xslt(xslt)
10         return create_embed('application/x-latex', data=unicode(output))