mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-04-30 15:43:17 +02:00
FB2 Output: Remove empty tags
This commit is contained in:
parent
58352097ad
commit
d02966423c
1 changed files with 2 additions and 0 deletions
|
|
@ -73,6 +73,8 @@ def fb2mlize_spine(self):
|
|||
return '<?xml version="1.0" encoding="UTF-8"?>\n' + output
|
||||
|
||||
def clean_text(self, text):
|
||||
# Remove empty tags.
|
||||
text = re.sub(r'(?miu)<(strong|emphasis|strikethrough|sub|sup)>\s*</\1>', '', text)
|
||||
# Condense empty paragraphs into a line break.
|
||||
text = re.sub(r'(?miu)(<p>\s*</p>\s*){3,}', '<empty-line/>', text)
|
||||
# Remove empty paragraphs.
|
||||
|
|
|
|||
Loading…
Reference in a new issue