From 1f014caf4454c5831ffb450b05569018a247f71d Mon Sep 17 00:00:00 2001 From: John Schember Date: Sat, 22 Aug 2009 23:15:23 -0400 Subject: [PATCH] Remove excessive newlines from TXT output. --- src/calibre/ebooks/txt/txtml.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/txt/txtml.py b/src/calibre/ebooks/txt/txtml.py index 24a9fb0878..09f9d5d50c 100644 --- a/src/calibre/ebooks/txt/txtml.py +++ b/src/calibre/ebooks/txt/txtml.py @@ -90,8 +90,8 @@ class TXTMLizer(object): text = re.sub('[ ]+', ' ', text) # Remove excessive newlines. - #text = re.sub('\n[ ]+\n', '\n\n', text) - #text = re.sub('\n{3,}', '\n\n', text) + text = re.sub('\n[ ]+\n', '\n\n', text) + text = re.sub('\n{5,}', '\n\n\n\n', text) # Replace spaces at the beginning and end of lines text = re.sub('(?imu)^[ ]+', '', text)