mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-08 20:35:18 +02: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
1 changed files with 16 additions and 0 deletions
|
|
@ -144,6 +144,22 @@ def upshift_markup(self): # {{{
|
|||
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…
Reference in a new issue