mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-11 20:43:50 -06:00
fix: strip links with bracketed text from meta
This commit is contained in:
1 parent
9930f46f03
commit
6846bb4e48
2 files changed
+17
-2
No files matched your search
@@ -2485,10 +2485,16 @@ def _browser_title(relative: Path, title: str) -> str:
|
||||
return title
|
||||
|
||||
|
||||
_LINK_TEXT = r"(?:`[^`]*`|\[[^\]\[]*\]|[^\]\[])"
|
||||
|
||||
|
||||
def _plain_markdown(text: str) -> str:
|
||||
text = re.sub(r"<[^>]+>", " ", text)
|
||||
text = re.sub(r"!\[([^]]*)\]\([^)]*\)", r"\1", text)
|
||||
text = re.sub(r"\[([^]]+)\]\([^)]*\)", r"\1", text)
|
||||
# Link text may hold brackets: a code span or a No-Intro name such as
|
||||
# `[BIOS] LaserActive PAC-N1 (Japan) (v1.02).bin` left the whole link,
|
||||
# anchor included, in the Pioneer page's meta description.
|
||||
text = re.sub(rf"!\[({_LINK_TEXT}*)\]\([^)]*\)", r"\1", text)
|
||||
text = re.sub(rf"\[({_LINK_TEXT}+)\]\([^)]*\)", r"\1", text)
|
||||
# Code spans keep their text whole: validate_schemas.py read
|
||||
# validateschemas.py once every underscore was taken for emphasis.
|
||||
pieces = re.split(r"(`[^`]*`)", text)
|
||||
|
||||
Reference in new issue
Block a user