mirror of
https://github.com/tldr-pages/tldr
synced 2026-08-26 14:13:36 +01:00
set-alias-page.py: prevent synchronizing alias pages that are non-standard (#19859)
This commit is contained in:
@@ -269,6 +269,15 @@ 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 stripped_template != stripped_en:
|
||||
return AliasPageContent(title="", original_command="", documentation_command="")
|
||||
|
||||
original_command = ""
|
||||
documentation_command = ""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user