From 162d86429deb95df251e2cf186e8199b1ed2013c Mon Sep 17 00:00:00 2001
From: Andrey Efremov
Date: Tue, 8 Oct 2019 12:19:02 +0700
Subject: [PATCH] FB2 Output: Ignore case flag is not required because the
writer outputs only lowercase tag names
---
src/calibre/ebooks/fb2/fb2ml.py | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/src/calibre/ebooks/fb2/fb2ml.py b/src/calibre/ebooks/fb2/fb2ml.py
index 433db22fa1..5697f2262a 100644
--- a/src/calibre/ebooks/fb2/fb2ml.py
+++ b/src/calibre/ebooks/fb2/fb2ml.py
@@ -74,38 +74,38 @@ class FB2MLizer(object):
def clean_text(self, text):
# Remove pointless tags, but keep their contents.
- text = re.sub(r'(?miu)<(strong|emphasis|strikethrough|sub|sup)>(\s*)\1>', r'\2', text)
+ text = re.sub(r'(?mu)<(strong|emphasis|strikethrough|sub|sup)>(\s*)\1>', r'\2', text)
# Clean up paragraphs endings.
- text = re.sub(r'(?miu)\s+
', '', text)
+ text = re.sub(r'(?mu)\s+', '', text)
# Condense empty paragraphs into a line break.
- text = re.sub(r'(?miu)(?:\s*){3,}', '', text)
+ text = re.sub(r'(?mu)(?:\s*){3,}', '', text)
# Remove empty paragraphs.
- text = re.sub(r'(?miu)', '', text)
+ text = re.sub(r'(?mu)', '', text)
# Put the paragraph following a paragraph on a separate line.
- text = re.sub(r'(?miu)\s*', '
\n', text)
+ text = re.sub(r'(?mu)
\s*', '
\n', text)
# Clean up title endings.
- text = re.sub(r'(?miu)\s+', '', text)
+ text = re.sub(r'(?mu)\s+', '', text)
# Remove empty title elements.
- text = re.sub(r'(?miu)
', '', text)
+ text = re.sub(r'(?mu)', '', text)
# Put the paragraph following a title on a separate line.
- text = re.sub(r'(?miu)\s*', '\n
', text)
+ text = re.sub(r'(?mu)\s*
', '\n
', text)
# Remove empty sections.
- text = re.sub(r'(?miu)', '', text)
+ text = re.sub(r'(?mu)', '', text)
# Clean up sections starts and ends.
- text = re.sub(r'(?miu)\s*\s*', '\n\n', text)
- text = re.sub(r'(?miu)\s*\s*', '\n\n', text)
+ text = re.sub(r'(?mu)\s*\s*', '\n\n', text)
+ text = re.sub(r'(?mu)\s*\s*', '\n\n', text)
# Put the section following a section on a separate line.
- text = re.sub(r'(?miu)\s*\n', text)
+ text = re.sub(r'(?mu)\s*\n', text)
if self.opts.insert_blank_line:
- text = re.sub(r'(?miu)
', '', text)
+ text = re.sub(r'(?mu)', '', text)
# Put line breaks between paragraphs on a separate line.
- text = re.sub(r'(?miu)(p|title)>\s*', r'\1>\n', text)
- text = re.sub(r'(?miu)\s*', '\n
', text)
+ text = re.sub(r'(?mu)(p|title)>\s*', r'\1>\n', text)
+ text = re.sub(r'(?mu)\s*
', '\n
', text)
return text