FB2 Output: Clean up output a bit more.

This commit is contained in:
John Schember 2010-08-26 07:25:08 -04:00
parent e8a0d60620
commit 7a7e9d2f28

View File

@ -91,7 +91,9 @@ class FB2MLizer(object):
return u'<?xml version="1.0" encoding="UTF-8"?>\n%s' % etree.tostring(etree.fromstring(output), encoding=unicode, pretty_print=True)
def clean_text(self, text):
text = re.sub('<p>\s*</p>', '', text)
text = re.sub(r'(?miu)<p>\s*</p>', '', text)
text = re.sub(r'(?miu)\s+</p>', '</p>', text)
text = re.sub(r'(?miu)</p><p>', '</p>\n\n<p>', text)
return text