mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Content server: When serving OPDS feeds handle html descriptions taht have namespaced attributes. Fixes #7938 (Stanza shows some authors as "catalog is empty")
This commit is contained in:
parent
847422e9b0
commit
51314ce5d8
@ -101,7 +101,19 @@ def html_to_lxml(raw):
|
|||||||
root = html.fragment_fromstring(raw)
|
root = html.fragment_fromstring(raw)
|
||||||
root.set('xmlns', "http://www.w3.org/1999/xhtml")
|
root.set('xmlns', "http://www.w3.org/1999/xhtml")
|
||||||
raw = etree.tostring(root, encoding=None)
|
raw = etree.tostring(root, encoding=None)
|
||||||
|
try:
|
||||||
return etree.fromstring(raw)
|
return etree.fromstring(raw)
|
||||||
|
except:
|
||||||
|
for x in root.iterdescendants():
|
||||||
|
remove = []
|
||||||
|
for attr in x.attrib:
|
||||||
|
if ':' in attr:
|
||||||
|
remove.append(attr)
|
||||||
|
for a in remove:
|
||||||
|
del x.attrib[a]
|
||||||
|
raw = etree.tostring(root, encoding=None)
|
||||||
|
return etree.fromstring(raw)
|
||||||
|
|
||||||
|
|
||||||
def CATALOG_ENTRY(item, item_kind, base_href, version, updated,
|
def CATALOG_ENTRY(item, item_kind, base_href, version, updated,
|
||||||
ignore_count=False, add_kind=False):
|
ignore_count=False, add_kind=False):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user