mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
915fa2f8e0
commit
b6d14d49c1
@ -81,7 +81,7 @@ def node_depth(node):
|
|||||||
def html5_parse(data, max_nesting_depth=100):
|
def html5_parse(data, max_nesting_depth=100):
|
||||||
import html5lib
|
import html5lib
|
||||||
# html5lib bug: http://code.google.com/p/html5lib/issues/detail?id=195
|
# html5lib bug: http://code.google.com/p/html5lib/issues/detail?id=195
|
||||||
data = re.sub(r'<\s*title\s*/\s*>', '<title></title>', data)
|
data = re.sub(r'<\s*title\s*[^>]*/\s*>', '<title></title>', data)
|
||||||
|
|
||||||
data = html5lib.parse(data, treebuilder='lxml').getroot()
|
data = html5lib.parse(data, treebuilder='lxml').getroot()
|
||||||
|
|
||||||
|
@ -47,7 +47,8 @@ class PMLInput(InputFormatPlugin):
|
|||||||
self.log.debug('Converting PML to HTML...')
|
self.log.debug('Converting PML to HTML...')
|
||||||
hizer = PML_HTMLizer()
|
hizer = PML_HTMLizer()
|
||||||
html = hizer.parse_pml(pml_stream.read().decode(ienc), html_path)
|
html = hizer.parse_pml(pml_stream.read().decode(ienc), html_path)
|
||||||
html_stream.write('<html><head><title /></head><body>%s</body></html>' % html.encode('utf-8', 'replace'))
|
html = '<html><head><title></title></head><body>%s</body></html>'%html
|
||||||
|
html_stream.write(html.encode('utf-8', 'replace'))
|
||||||
|
|
||||||
if pclose:
|
if pclose:
|
||||||
pml_stream.close()
|
pml_stream.close()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user