mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
AZW3 Output: Ignore invalid attribute names in the input document rather than aborting the conversion on them.
This commit is contained in:
parent
0e93afb1e5
commit
a10c7f9a35
@ -237,9 +237,12 @@ class Chunker(object):
|
|||||||
tn = tag.tag
|
tn = tag.tag
|
||||||
if tn is not None:
|
if tn is not None:
|
||||||
tn = tn.rpartition('}')[-1]
|
tn = tn.rpartition('}')[-1]
|
||||||
elem = nroot.makeelement(tn,
|
attrib = {k.rpartition('}')[-1]:v for k, v in tag.attrib.iteritems()}
|
||||||
attrib={k.rpartition('}')[-1]:v for k, v in
|
try:
|
||||||
tag.attrib.iteritems()})
|
elem = nroot.makeelement(tn, attrib=attrib)
|
||||||
|
except ValueError:
|
||||||
|
attrib = {k:v for k, v in attrib.iteritems() if ':' not in k}
|
||||||
|
elem = nroot.makeelement(tn, attrib=attrib)
|
||||||
elem.text = tag.text
|
elem.text = tag.text
|
||||||
elem.tail = tag.tail
|
elem.tail = tag.tail
|
||||||
parent = node_from_path(nroot, path_to_node(tag.getparent()))
|
parent = node_from_path(nroot, path_to_node(tag.getparent()))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user