mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-01-06 18:25:10 +01:00
...
This commit is contained in:
parent
915fa2f8e0
commit
b6d14d49c1
2 changed files with 3 additions and 2 deletions
|
|
@ -81,7 +81,7 @@ def node_depth(node):
|
|||
def html5_parse(data, max_nesting_depth=100):
|
||||
import html5lib
|
||||
# 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()
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,8 @@ def process_pml(self, pml_path, html_path, close_all=False):
|
|||
self.log.debug('Converting PML to HTML...')
|
||||
hizer = PML_HTMLizer()
|
||||
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:
|
||||
pml_stream.close()
|
||||
|
|
|
|||
Loading…
Reference in a new issue