diff --git a/src/calibre/ebooks/pml/pmlconverter.py b/src/calibre/ebooks/pml/pmlconverter.py index 2c97f509fa..b4ab238da9 100644 --- a/src/calibre/ebooks/pml/pmlconverter.py +++ b/src/calibre/ebooks/pml/pmlconverter.py @@ -45,11 +45,11 @@ PML_HTML_RULES = [ (re.compile(r'\\Sd="(?P.+?)"(?P.*?)\\Sd'), lambda match: '%s' % (match.group('target'), match.group('text')) if match.group('text') else ''), # Just italicize index items as that is how the eReader software renders them. (re.compile(r'\\I(?P.*?)\\I', re.DOTALL), lambda match: '%s' % match.group('text') if match.group('text') else ''), - + # Sidebar and Footnotes (re.compile(r'.+?)">\s*(?P.*?)\s*', re.DOTALL), lambda match: '' % (match.group('target'), match.group('text')) if match.group('text') else ''), (re.compile(r'.+?)">\s*(?P.*?)\s*', re.DOTALL), lambda match: '
%s
' % (match.group('target'), match.group('text')) if match.group('text') else ''), - + # eReader files are one paragraph per line. # This forces the lines to wrap properly. (re.compile('^(?P.+)$', re.MULTILINE), lambda match: '

%s

' % match.group('text')), @@ -57,7 +57,7 @@ PML_HTML_RULES = [ (re.compile('

[ ]*

'), lambda match: ''), # Ensure empty lines carry over. (re.compile('(\r\n|\n|\r){3}'), lambda match: '
'), - + # Remove unmatched plm codes. (re.compile(r'(?<=[^\\])\\[pxcriouvtblBk]'), lambda match: ''), (re.compile(r'(?<=[^\\])\\X[0-4]'), lambda match: ''), @@ -65,7 +65,7 @@ PML_HTML_RULES = [ (re.compile(r'(?<=[^\\])\\Sb'), lambda match: ''), # Remove invalid single item pml codes. (re.compile(r'(?<=[^\\])\\.'), lambda match: ''), - + # Replace \\ with \. (re.compile(r'\\\\'), lambda match: '\\'), ] @@ -79,5 +79,5 @@ def pml_to_html(pml): def footnote_sidebar_to_html(id, pml): html = '
%s
' % (id, id, pml_to_html(pml)) - return html + return html