From e9cdd3f1f653de79f94ddfcdf319fcc31e7f0cef Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Thu, 20 Jun 2013 13:23:02 +0200 Subject: [PATCH] Workaround for nasty literal HTML inserting issue. --- librarian/xmlutils.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/librarian/xmlutils.py b/librarian/xmlutils.py index 9e921a2..8890f4e 100644 --- a/librarian/xmlutils.py +++ b/librarian/xmlutils.py @@ -22,14 +22,15 @@ class Xmill(object): self.text_filters.append(fun) def filter_text(self, text): - for flt in self.text_filters: - if text is None: - return None - text = flt(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] + # This whole mixing text with ML is so wrong. + output = etree.tostring(e, encoding=unicode)[3:-4] + for flt in self.text_filters: + output = flt(output) + return output + def generate(self, document): """Generate text from node using handlers defined in class.""" -- 2.20.1