X-Git-Url: https://git.mdrn.pl/librarian.git/blobdiff_plain/716a9ab552bffbb7df2cb31ae41ee196902c7653..4b0833f222da430d31356b6f065e56073b849d0f:/src/librarian/embeds/mathml.py?ds=inline diff --git a/src/librarian/embeds/mathml.py b/src/librarian/embeds/mathml.py index 801c213..f633fc4 100644 --- a/src/librarian/embeds/mathml.py +++ b/src/librarian/embeds/mathml.py @@ -1,8 +1,7 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - +# This file is part of Librarian, licensed under GNU Affero GPLv3 or later. +# Copyright © Fundacja Wolne Lektury. See NOTICE for more information. +# from lxml import etree -import six from librarian import get_resource from . import TreeEmbed, create_embed, downgrades_to @@ -12,19 +11,19 @@ class MathML(TreeEmbed): def to_latex(self): """ >>> print(MathML(etree.fromstring( - 'a < b' - )).to_latex().data.strip()) + ... 'a < b' + ... )).to_latex().data.strip()) a < b >>> print(MathML(etree.fromstring( - '< & &lt; A' - )).to_latex().data.strip()) + ... '< & &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) + text = str(output) # Workaround for entities being preserved in output. # But there should be a better way. text = text.replace('<', '<').replace('&', '&')