diff --git a/src/calibre/ebooks/conversion/utils.py b/src/calibre/ebooks/conversion/utils.py index f541701480..a9f733277a 100644 --- a/src/calibre/ebooks/conversion/utils.py +++ b/src/calibre/ebooks/conversion/utils.py @@ -379,13 +379,13 @@ class HeuristicProcessor(object): html = re.sub('(?i)?st1:\w+>', '', html) # Re-open self closing paragraph tags html = re.sub('
/]*/>', '
', html) - # delete surrounding divs from empty paragraphs - html = re.sub('
]*>\s*
\s*', html) # Get rid of empty span, bold, font, em, & italics tags html = re.sub(r"\s*]*>\s*(]*>\s*){0,2}\s*\s*", " ", html) html = re.sub(r"\s*<(font|[ibu]|em|strong)[^>]*>\s*(<(font|[ibu]|em|strong)[^>]*>\s*(font|[ibu]|em|strong)>\s*){0,2}\s*(font|[ibu]|em|strong)>", " ", html) html = re.sub(r"\s*]*>\s*(]>\s*){0,2}\s*\s*", " ", html) html = re.sub(r"\s*<(font|[ibu]|em|strong)[^>]*>\s*(<(font|[ibu]|em|strong)[^>]*>\s*(font|[ibu]|em|strong)>\s*){0,2}\s*(font|[ibu]|em|strong)>", " ", html) + # delete surrounding divs from empty paragraphs + html = re.sub('
]*>\s*
\s*', html) # Empty heading tags html = re.sub(r'(?i)