drop anchor links to figures

This commit is contained in:
Artem Goncharov 2022-03-28 17:25:56 +02:00
parent 6110707001
commit 6a28ae6c96

View File

@ -177,6 +177,17 @@ def main():
for lnk in proc.find_all("a"):
href = lnk.get('href')
if href:
# Drop anchor links to "Figure"s
if (
(lnk.content and lnk.content.startswith('Figure'))
or
(
lnk.contents
and ''.join(lnk.contents).startswith('Figure')
)
):
lnk.unwrap()
else:
page_url = ''
anchor = ''
href_parts = href.split('#')