mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Pull from driver-dev
This commit is contained in:
commit
2953e8c95b
@ -60,6 +60,8 @@ PML_HTML_RULES = [
|
||||
(re.compile(r'(?<=[^\\])\\X[0-4]'), lambda match: ''),
|
||||
(re.compile(r'(?<=[^\\])\\Sp'), lambda match: ''),
|
||||
(re.compile(r'(?<=[^\\])\\Sb'), lambda match: ''),
|
||||
# Remove invalid single item pml codes.
|
||||
(re.compile(r'(?<=[^\\])\\.'), lambda match: ''),
|
||||
|
||||
# Replace \\ with \.
|
||||
(re.compile(r'\\\\'), lambda match: '\\'),
|
||||
@ -70,12 +72,6 @@ def pml_to_html(pml):
|
||||
for rule in PML_HTML_RULES:
|
||||
html = rule[0].sub(rule[1], html)
|
||||
|
||||
# Turn special characters into entities.
|
||||
cps = [ord(c) for c in set(html)]
|
||||
cps = set(cps).intersection(codepoint2name.keys()).difference([60, 62])
|
||||
for cp in cps:
|
||||
html = html.replace(unichr(cp), '&%s;' % codepoint2name[cp])
|
||||
|
||||
return html
|
||||
|
||||
def footnote_sidebar_to_html(id, pml):
|
||||
|
Loading…
x
Reference in New Issue
Block a user