From 7a7e9d2f28cd70c78d6ca48c66d37cf33ec47f47 Mon Sep 17 00:00:00 2001
From: John Schember
Date: Thu, 26 Aug 2010 07:25:08 -0400
Subject: [PATCH] FB2 Output: Clean up output a bit more.
---
src/calibre/ebooks/fb2/fb2ml.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/calibre/ebooks/fb2/fb2ml.py b/src/calibre/ebooks/fb2/fb2ml.py
index d57389445c..11596b9df9 100644
--- a/src/calibre/ebooks/fb2/fb2ml.py
+++ b/src/calibre/ebooks/fb2/fb2ml.py
@@ -91,7 +91,9 @@ class FB2MLizer(object):
return u'\n%s' % etree.tostring(etree.fromstring(output), encoding=unicode, pretty_print=True)
def clean_text(self, text):
- text = re.sub('\s*
', '', text)
+ text = re.sub(r'(?miu)\s*
', '', text)
+ text = re.sub(r'(?miu)\s+
', '', text)
+ text = re.sub(r'(?miu)', '
\n\n', text)
return text