From d02966423c2201558494a3a9bd9698cf24741d11 Mon Sep 17 00:00:00 2001 From: Andrey Efremov Date: Mon, 7 Oct 2019 12:28:18 +0700 Subject: [PATCH] FB2 Output: Remove empty tags --- src/calibre/ebooks/fb2/fb2ml.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/calibre/ebooks/fb2/fb2ml.py b/src/calibre/ebooks/fb2/fb2ml.py index 04d8ade536..4421623869 100644 --- a/src/calibre/ebooks/fb2/fb2ml.py +++ b/src/calibre/ebooks/fb2/fb2ml.py @@ -73,6 +73,8 @@ class FB2MLizer(object): return '\n' + output def clean_text(self, text): + # Remove empty tags. + text = re.sub(r'(?miu)<(strong|emphasis|strikethrough|sub|sup)>\s*', '', text) # Condense empty paragraphs into a line break. text = re.sub(r'(?miu)(

\s*

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