X-Git-Url: https://git.mdrn.pl/librarian.git/blobdiff_plain/3ffce80e2f1c58f741cd6a3d31aa86199e8874f1..f20435fd054f9176b8f867cd85322697d242b493:/librarian/xmlutils.py?ds=inline diff --git a/librarian/xmlutils.py b/librarian/xmlutils.py index 97a3039..9e921a2 100644 --- a/librarian/xmlutils.py +++ b/librarian/xmlutils.py @@ -26,7 +26,10 @@ class Xmill(object): if text is None: return None text = flt(text) - return text + # TODO: just work on the tree and let lxml handle escaping. + e = etree.Element("x") + e.text = text + return etree.tostring(e, encoding=unicode)[3:-4] def generate(self, document): """Generate text from node using handlers defined in class.""" @@ -39,7 +42,7 @@ class Xmill(object): """ # Here we can see how a decision not to return the modified map # leads to a need for a hack. - return reduce(lambda a, b: a.update(b) or a, self._options, defaultdict(lambda: False)) + return reduce(lambda a, b: a.update(b) or a, self._options, defaultdict(lambda: None)) @options.setter def options(self, opts):