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:
Kovid Goyal 2018-05-01 14:49:18 +05:30
parent 499578beaa
commit b1ee6be746
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -310,6 +310,7 @@ def get_nav_landmarks(container):
for li in elem.iterdescendants(XHTML('li')): for li in elem.iterdescendants(XHTML('li')):
for a in li.iterdescendants(XHTML('a')): for a in li.iterdescendants(XHTML('a')):
href, rtype = a.get('href'), a.get(et) href, rtype = a.get('href'), a.get(et)
if href:
title = etree.tostring(a, method='text', encoding=unicode, with_tail=False).strip() title = etree.tostring(a, method='text', encoding=unicode, with_tail=False).strip()
href, frag = href.partition('#')[::2] href, frag = href.partition('#')[::2]
name = container.href_to_name(href, nav) name = container.href_to_name(href, nav)