mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
Tweak Book: When rebuilding azw3 files handle <a> tags that have name but not id attribute, these are apparently produced by kindlegen. Fixes #1112934 (links are borken in azw3 (KF8) when tweaking book)
This commit is contained in:
parent
e0e1bafbca
commit
b94aff86bf
@ -241,6 +241,11 @@ class KF8Writer(object):
|
||||
j = 0
|
||||
for tag in root.iterdescendants(etree.Element):
|
||||
id_ = tag.attrib.get('id', None)
|
||||
if id_ is None:
|
||||
# Can happen during tweaking
|
||||
id_ = tag.attrib.get('name', None)
|
||||
if id_ is not None:
|
||||
tag.attrib['id'] = id_
|
||||
if id_ is not None or barename(tag.tag).lower() in aid_able_tags:
|
||||
aid = aidbase + j
|
||||
tag.attrib['aid'] = to_base(aid, base=32)
|
||||
|
Loading…
x
Reference in New Issue
Block a user