Fix DeprecationWarning

This commit is contained in:
Kovid Goyal 2025-02-09 10:04:49 +05:30
parent c4cca578e4
commit 4b6d6560f2
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -122,7 +122,7 @@ def cleanup_markup(log, root, styles, dest_dir, detect_cover, XPath, uuid):
span.attrib.pop('data-noteref-container')
parent = span.getparent()
idx = parent.index(span)
if idx + 1 < len(parent) and (ns := parent[idx+1]) and hasattr(ns, 'get') and ns.get('data-noteref-container'):
if idx + 1 < len(parent) and len(ns := parent[idx+1]) and hasattr(ns, 'get') and ns.get('data-noteref-container'):
if len(span) and not span[-1].tail:
span[-1].tail = '\xa0'