mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
tweaks.
This commit is contained in:
parent
fb7ecb5cf2
commit
2bdc1afa25
@ -31,5 +31,5 @@ class Reader(FormatReader):
|
|||||||
def dump_pml(self):
|
def dump_pml(self):
|
||||||
return self.reader.dump_pml()
|
return self.reader.dump_pml()
|
||||||
|
|
||||||
def dump_images(self):
|
def dump_images(self, out_dir):
|
||||||
return self.reader.dump_images()
|
return self.reader.dump_images(out_dir)
|
||||||
|
@ -10,16 +10,10 @@ __docformat__ = 'restructuredtext en'
|
|||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from calibre import my_unichr
|
from calibre import my_unichr, prepare_string_for_xml
|
||||||
from calibre.ebooks.pdb.ereader import image_name
|
from calibre.ebooks.pdb.ereader import image_name
|
||||||
|
|
||||||
PML_HTML_RULES = [
|
PML_HTML_RULES = [
|
||||||
# Any literal <, &, and > chars be escaped to avoid HTML issues (though
|
|
||||||
# <footnote> and <sidebar> tags are handled specially later).
|
|
||||||
(re.compile(r'&'), lambda match: '&'),
|
|
||||||
(re.compile(r'<'), lambda match: '<'),
|
|
||||||
(re.compile(r'>'), lambda match: '>'),
|
|
||||||
|
|
||||||
# NOP-process all \x escapes, turning \\ into \ This keeps the regex
|
# NOP-process all \x escapes, turning \\ into \ This keeps the regex
|
||||||
# parsing simple while making sure that we don't try to honor \\x as \x
|
# parsing simple while making sure that we don't try to honor \\x as \x
|
||||||
# (and also makes sure we DO honor \\\x as \ followed by \x).
|
# (and also makes sure we DO honor \\\x as \ followed by \x).
|
||||||
@ -83,7 +77,7 @@ PML_HTML_RULES = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
def pml_to_html(pml):
|
def pml_to_html(pml):
|
||||||
html = pml
|
html = prepare_string_for_xml(pml)
|
||||||
for rule in PML_HTML_RULES:
|
for rule in PML_HTML_RULES:
|
||||||
html = rule[0].sub(rule[1], html)
|
html = rule[0].sub(rule[1], html)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user