mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 18:54:09 -04:00
pep8
This commit is contained in:
parent
32de3c16ea
commit
ddbff0f23d
@ -44,8 +44,10 @@ META_XP = XPath('/h:html/h:head/h:meta[@http-equiv="Content-Type"]')
|
||||
|
||||
def merge_multiple_html_heads_and_bodies(root, log=None):
|
||||
heads, bodies = xpath(root, '//h:head'), xpath(root, '//h:body')
|
||||
if not (len(heads) > 1 or len(bodies) > 1): return root
|
||||
for child in root: root.remove(child)
|
||||
if not (len(heads) > 1 or len(bodies) > 1):
|
||||
return root
|
||||
for child in root:
|
||||
root.remove(child)
|
||||
head = root.makeelement(XHTML('head'))
|
||||
body = root.makeelement(XHTML('body'))
|
||||
for h in heads:
|
||||
@ -368,8 +370,7 @@ def parse_html(data, log=None, decoder=None, preprocessor=None,
|
||||
meta.getparent().remove(meta)
|
||||
meta = etree.SubElement(head, XHTML('meta'),
|
||||
attrib={'http-equiv': 'Content-Type'})
|
||||
meta.set('content', 'text/html; charset=utf-8') # Ensure content is second
|
||||
# attribute
|
||||
meta.set('content', 'text/html; charset=utf-8') # Ensure content is second attribute
|
||||
|
||||
# Ensure has a <body/>
|
||||
if not xpath(data, '/h:html/h:body'):
|
||||
|
Loading…
x
Reference in New Issue
Block a user