remove empty anchor tags

master
Aevann1 2022-07-02 02:54:59 +02:00
parent 28786342dc
commit 77c1f96383
1 changed files with 2 additions and 0 deletions

View File

@ -221,6 +221,8 @@ def sanitize(sanitized, edit=False):
a.append(tag)
for tag in soup.find_all("a"):
if not tag.contents or not str(tag.contents[0]).strip():
tag.extract()
if tag.get("href") and fishylinks_regex.fullmatch(str(tag.string)):
tag.string = tag["href"]