Skip to content

Commit 8baccbe

Browse files
sbryngelsonclaude
andcommitted
Fix @ref/@page regex to support hyphenated IDs
The \w+ pattern stopped at hyphens, so @page getting-started was extracted as "getting" and @ref cli-reference as "cli". Use [\w-]+ to match the full hyphenated identifiers. Remove the cli-reference hardcoded workaround that was papering over this bug. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent dae98ab commit 8baccbe

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

toolchain/mfc/lint_docs.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@
5959
"docs/documentation/case.md": CASE_MD_SKIP,
6060
}
6161

62-
# Match @ref page_id patterns
63-
REF_RE = re.compile(r"@ref\s+(\w+)")
62+
# Match @ref page_id patterns (page IDs may contain hyphens)
63+
REF_RE = re.compile(r"@ref\s+([\w-]+)")
6464

6565

6666
def check_docs(repo_root: Path) -> list[str]:
@@ -368,12 +368,12 @@ def check_page_refs(repo_root: Path) -> list[str]:
368368
if not doc_dir.exists():
369369
return []
370370

371-
# Collect all @page identifiers
371+
# Collect all @page identifiers (IDs may contain hyphens)
372372
# Include Doxygen built-ins and auto-generated pages (created by ./mfc.sh generate)
373-
page_ids = {"citelist", "parameters", "case_constraints", "physics_constraints", "examples", "cli-reference"}
373+
page_ids = {"citelist", "parameters", "case_constraints", "physics_constraints", "examples"}
374374
for md_file in doc_dir.glob("*.md"):
375375
text = md_file.read_text(encoding="utf-8")
376-
m = re.search(r"^\s*@page\s+(\w+)", text, flags=re.MULTILINE)
376+
m = re.search(r"^\s*@page\s+([\w-]+)", text, flags=re.MULTILINE)
377377
if m:
378378
page_ids.add(m.group(1))
379379

0 commit comments

Comments
 (0)