From aa61a3f51f55eb6649986856f51bee9dc3664576 Mon Sep 17 00:00:00 2001 From: Lukasz Boryn Date: Wed, 22 Jul 2026 14:05:19 +0200 Subject: [PATCH] fix(okf-check): treat a cite line range as a reading aid, not a symbol A `path:92-97` cite fell through the `isdigit()` suffix rule and was matched as a literal symbol, so it could never resolve. Line ranges are the same reading aid a bare line number is, and are idiomatic in this repo prose, so the grammar now admits `N` and `N-M` alike. --- skills/loop/write-OKF/okf-layout.md | 3 ++- skills/loop/write-OKF/scripts/okf-check | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/skills/loop/write-OKF/okf-layout.md b/skills/loop/write-OKF/okf-layout.md index 9ac6c7e..876245a 100644 --- a/skills/loop/write-OKF/okf-layout.md +++ b/skills/loop/write-OKF/okf-layout.md @@ -47,7 +47,8 @@ loop, not on disk. `path:symbol`; all three resolve only if the path exists. `path:symbol` additionally needs the symbol as a literal substring of the file — that is the shape that breaks when the thing it cites moves. A `path:line` - number is a reading aid, never validated. + suffix — one number or a `92-97` range — is a reading aid, never + validated. - **Derived zone** — a page carries at most one region delimited by `` and ``, each marker alone on its line. Refresh regenerates the inside wholesale and may not diff --git a/skills/loop/write-OKF/scripts/okf-check b/skills/loop/write-OKF/scripts/okf-check index 519125c..1a378ce 100755 --- a/skills/loop/write-OKF/scripts/okf-check +++ b/skills/loop/write-OKF/scripts/okf-check @@ -17,6 +17,7 @@ import sys from pathlib import Path CAP = 110 +LINE_SUFFIX = re.compile(r"\d+(-\d+)?") def frontmatter(text): @@ -94,14 +95,14 @@ def cite_resolves(cite, page, okf): """`path` and `path:line` need the path; `path:symbol` needs both. The symbol is matched as a literal substring — no language awareness, - no tags file. A `:suffix` that parses as an integer is a reading aid, - never validated: a check that cannot fail is not a check. + no tags file. A `:suffix` that is a line number or a line range is a + reading aid, never validated: a check that cannot fail is not a check. """ path, _, symbol = cite.split("#")[0].partition(":") path, symbol = path.strip(), symbol.strip() if not path: return False - if symbol.isdigit(): + if LINE_SUFFIX.fullmatch(symbol): symbol = "" for root in (page.parent, okf, okf.parent): target = root / path