mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Edit Book: Fix an error caused by a landmark entry in EPUB 3 files that has an <a> tag without an href attribute.
This commit is contained in:
parent
499578beaa
commit
b1ee6be746
@ -310,12 +310,13 @@ def get_nav_landmarks(container):
|
||||
for li in elem.iterdescendants(XHTML('li')):
|
||||
for a in li.iterdescendants(XHTML('a')):
|
||||
href, rtype = a.get('href'), a.get(et)
|
||||
title = etree.tostring(a, method='text', encoding=unicode, with_tail=False).strip()
|
||||
href, frag = href.partition('#')[::2]
|
||||
name = container.href_to_name(href, nav)
|
||||
if container.has_name(name):
|
||||
yield {'dest':name, 'frag':frag, 'title':title or '', 'type':rtype or ''}
|
||||
break
|
||||
if href:
|
||||
title = etree.tostring(a, method='text', encoding=unicode, with_tail=False).strip()
|
||||
href, frag = href.partition('#')[::2]
|
||||
name = container.href_to_name(href, nav)
|
||||
if container.has_name(name):
|
||||
yield {'dest':name, 'frag':frag, 'title':title or '', 'type':rtype or ''}
|
||||
break
|
||||
|
||||
|
||||
def get_landmarks(container):
|
||||
|
Loading…
x
Reference in New Issue
Block a user