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
This commit is contained in:
Kovid Goyal 2021-04-15 13:16:53 +05:30
parent 3f2bc45368
commit 1c24a53865
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -79,7 +79,7 @@ class FB2MLizer(object):
text = re.sub(r'(?mu)<(strong|emphasis|strikethrough|sub|sup)>(\s*)</\1>', r'\2', text)
# Clean up paragraphs endings.
text = re.sub(r'(?mu)\s+</p>', '</p>', text)
text = re.sub(r'(?ma)\s+</p>', '</p>', text)
# Condense empty paragraphs into a line break.
text = re.sub(r'(?mu)(?:<p></p>\s*){3,}', '<empty-line/>', text)
# Remove empty paragraphs.