diff --git a/src/calibre/ebooks/oeb/base.py b/src/calibre/ebooks/oeb/base.py index 43e951354f..096f041ca6 100644 --- a/src/calibre/ebooks/oeb/base.py +++ b/src/calibre/ebooks/oeb/base.py @@ -946,7 +946,8 @@ class Manifest(object): # ones, as they are interpreted incorrectly by some browser # based renderers ans = re.sub( - r'<(?Pdiv|a|span)(?=[\s/])(?P[^>]*)/\s*>', + # tag name followed by either a space or a / + r'<(?Pdiv|a|span)(?=[\s/])(?P[^>]*)/>', r'<\g\g>>', ans) return ans if isinstance(data, unicode):