From 1c24a53865ad76672cea08ef3ff2e9e5e4e93b42 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 15 Apr 2021 13:16:53 +0530 Subject: [PATCH] FB2 Output: Fix a regression in calibre 5 that caused paragraphs containing only non-breaking spaces to be removed. Fixes #1924232 [Empty lines missing after FB2 conversion](https://bugs.launchpad.net/calibre/+bug/1924232) py3 compat \s+ matches nbsp in python 3 but not python2 --- src/calibre/ebooks/fb2/fb2ml.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/ebooks/fb2/fb2ml.py b/src/calibre/ebooks/fb2/fb2ml.py index 46e52fdd13..8b74efe9e7 100644 --- a/src/calibre/ebooks/fb2/fb2ml.py +++ b/src/calibre/ebooks/fb2/fb2ml.py @@ -79,7 +79,7 @@ class FB2MLizer(object): text = re.sub(r'(?mu)<(strong|emphasis|strikethrough|sub|sup)>(\s*)', r'\2', text) # Clean up paragraphs endings. - text = re.sub(r'(?mu)\s+

', '

', text) + text = re.sub(r'(?ma)\s+

', '

', text) # Condense empty paragraphs into a line break. text = re.sub(r'(?mu)(?:

\s*){3,}', '', text) # Remove empty paragraphs.