Correct detection of dropping anchorlink from page title (#3325)

This commit is contained in:
Oleh Prypin
2023-08-02 11:45:35 +02:00
committed by GitHub
parent fcb2da399f
commit 63052bc1be

View File

@@ -437,7 +437,7 @@ class _ExtractTitleTreeprocessor(markdown.treeprocessors.Treeprocessor):
for el in root:
if el.tag == 'h1':
# Drop anchorlink from the element, if present.
if len(el) > 0 and el[-1].tag == 'a' and not (el.tail or '').strip():
if len(el) > 0 and el[-1].tag == 'a' and not (el[-1].tail or '').strip():
el = copy.copy(el)
del el[-1]
# Extract the text only, recursively.