mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
EPUB Output: Remove duplicate id and anme attributes to eliminate pointless noise from the various epub check utilities
This commit is contained in:
parent
d239e0907e
commit
a509176037
@ -144,6 +144,22 @@ class EPUBOutput(OutputFormatPlugin):
|
||||
for u in XPath('//h:u')(root):
|
||||
u.tag = 'span'
|
||||
u.set('style', 'text-decoration:underline')
|
||||
|
||||
seen_ids, seen_names = set(), set()
|
||||
for x in XPath('//*[@id or @name]')(root):
|
||||
eid, name = x.get('id', None), x.get('name', None)
|
||||
if eid:
|
||||
if eid in seen_ids:
|
||||
del x.attrib['id']
|
||||
else:
|
||||
seen_ids.add(eid)
|
||||
if name:
|
||||
if name in seen_names:
|
||||
del x.attrib['name']
|
||||
else:
|
||||
seen_names.add(name)
|
||||
|
||||
|
||||
# }}}
|
||||
|
||||
def convert(self, oeb, output_path, input_plugin, opts, log):
|
||||
|
Loading…
x
Reference in New Issue
Block a user