mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-03 22:15:52 +02: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
1 changed files with 6 additions and 3 deletions
|
|
@ -237,9 +237,12 @@ def remove_namespaces(self, root):
|
|||
tn = tag.tag
|
||||
if tn is not None:
|
||||
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 tag.attrib.iteritems()}
|
||||
try:
|
||||
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.tail = tag.tail
|
||||
parent = node_from_path(nroot, path_to_node(tag.getparent()))
|
||||
|
|
|
|||
Loading…
Reference in a new issue