Example #1
0
 def __call__(self, container):
     from calibre.ebooks.oeb.base import uuid_id
     from calibre.ebooks.oeb.polish.replace import replace_ids
     newid = uuid_id()
     changed = False
     elems = (e for e in container.parsed(self.name).xpath('//*[@id]') if e.get('id') == self.invalid_id)
     for e in elems:
         e.set('id', newid)
         changed = True
         container.dirty(self.name)
     if changed:
         replace_ids(container, {self.name:{self.invalid_id:newid}})
     return changed
Example #2
0
 def __call__(self, container):
     from calibre.ebooks.oeb.base import uuid_id
     from calibre.ebooks.oeb.polish.replace import replace_ids
     newid = uuid_id()
     changed = False
     elems = (e for e in container.parsed(self.name).xpath('//*[@id]') if e.get('id') == self.invalid_id)
     for e in elems:
         e.set('id', newid)
         changed = True
         container.dirty(self.name)
     if changed:
         replace_ids(container, {self.name:{self.invalid_id:newid}})
     return changed