scripts/set-alias-page.py: fix "page updated" spam when it wasn't being updated (#19941)

This commit is contained in:
Managor
2025-12-12 17:10:31 +02:00
committed by GitHub
parent 7113626105
commit 75f4337957
+12 -7
View File
@@ -269,14 +269,19 @@ def get_alias_command_in_page(path: Path, alias_pattern: str) -> AliasPageConten
if len(command_lines) != 2 or not title:
return AliasPageContent(title="", original_command="", documentation_command="")
stripped_template = config.templates["en"].replace("example", "")
stripped_en = content
stripped_en = re.sub(r"#.*", "# ", stripped_en)
stripped_en = re.sub(r"`(?!tldr).*`", "``", stripped_en)
stripped_en = re.sub(r"`tldr .*`", "`tldr `", stripped_en)
if alias_pattern == get_locale_alias_pattern("en"):
stripped_template = config.templates["en"]
stripped_template = stripped_template.replace("example", "")
if stripped_template != stripped_en:
return AliasPageContent(title="", original_command="", documentation_command="")
stripped_en = content
stripped_en = re.sub(r"#.*", "# ", stripped_en)
stripped_en = re.sub(r"`(?!tldr).*`", "``", stripped_en)
stripped_en = re.sub(r"`tldr .*`", "`tldr `", stripped_en)
if stripped_template != stripped_en:
return AliasPageContent(
title="", original_command="", documentation_command=""
)
original_command = ""
documentation_command = ""