🐛 fix(tsl-syntax): remove body routing instructions

This commit is contained in:
csh
2026-07-13 09:16:53 +08:00
parent b4d2fc8246
commit 617275e92d
22 changed files with 84 additions and 74 deletions
+10
View File
@@ -37,6 +37,10 @@ TOPIC_REFERENCES = {
"24_object_overloads_and_iteration.md",
}
MARKDOWN_LINK = re.compile(r"!?\[[^\]]*\]\(([^)]+)\)")
OPERATIONAL_TOPIC_LINK = re.compile(
r"(?:跳到|跳转到|转到|回到|回看|回(?=\s*\[)|进入|移到)"
r"(?=[^。\n]*\[[^\]]+\]\((?:0[1-9]|1[0-9]|2[0-4])_[^)]+\.md(?:#[^)]+)?\))"
)
def read_text(path: Path) -> str:
@@ -97,6 +101,12 @@ class TslSyntaxReferenceSkillStructureTest(unittest.TestCase):
for forbidden in ("路由中心", "选择一个主专题", "候选页继续判断"):
self.assertNotIn(forbidden, corpus)
def test_topic_pages_do_not_instruct_manual_navigation(self) -> None:
for path in REFERENCES_DIR.glob("*.md"):
for line_number, line in enumerate(read_text(path).splitlines(), start=1):
with self.subTest(path=path.name, line=line_number):
self.assertIsNone(OPERATIONAL_TOPIC_LINK.search(line), line)
def test_json_router_is_absent(self) -> None:
self.assertFalse((REFERENCES_DIR / "00_agent_index.json").exists())
self.assertFalse((ROOT / "docs" / "tsl" / "syntax" / "00_agent_index.json").exists())