aboutsummaryrefslogtreecommitdiff
path: root/lib/kernel/overlay_ini.ml
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-08-20 22:40:13 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-08-20 22:40:13 +0200
commitf73bd5d0e33146c24af1e98bf9ea26bd8cbf004b (patch)
tree790100dcc0077532d9446478e51d4cd40209c1c6 /lib/kernel/overlay_ini.ml
parent2d8942e08edcbe5430f97270bdb1233e287600ee (diff)
parent671c4264707ec8c81845059746632b00f2481d88 (diff)
downloadcolitur-f73bd5d0e33146c24af1e98bf9ea26bd8cbf004b.tar.gz
colitur-f73bd5d0e33146c24af1e98bf9ea26bd8cbf004b.zip
Merge branch 'robustness-and-hackability'
An audit of the shipped program, plus the fixes it found. The citation parser accepted OCaml integer-literal syntax, so a typo like 'Luke 1_1:5' silently became a different chapter. Four pairs of different books shared a full title -- 1 and 2 Corinthians both rendered 'Epistola ad Corinthios' -- leaving 108 citations in 2027 alone that a reader could not resolve to a book. Spec section 8.5 is now delivered rather than recorded: shipped styles re-parse their own output. Overlay errors no longer name OCaml source files at the reader. Also: the new-overlay scaffold shows citations at the right nesting level, config --show validates before printing, error messages no longer echo whole file lines, and a month answers to both spellings of its own name.
Diffstat (limited to 'lib/kernel/overlay_ini.ml')
-rw-r--r--lib/kernel/overlay_ini.ml13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/kernel/overlay_ini.ml b/lib/kernel/overlay_ini.ml
index 6b6249f..09f6d52 100644
--- a/lib/kernel/overlay_ini.ml
+++ b/lib/kernel/overlay_ini.ml
@@ -37,7 +37,18 @@ let parse_sections text =
end
else
match String.index_opt line '=' with
- | None -> err "line %d: %S is neither a [section] nor a key = value line" n line
+ | None ->
+ (* Echo at most a little of the line. Pointing at line N is
+ what locates the problem; reproducing the whole line adds
+ nothing and, when someone has pointed a --lang or --overlay
+ flag at a file that is not a calendar at all, quietly
+ copies that file's contents into stderr and any log
+ collecting it. *)
+ let shown =
+ if String.length line > 40 then String.sub line 0 37 ^ "..."
+ else line
+ in
+ err "line %d: %S is neither a [section] nor a key = value line" n shown
| Some i ->
if !cur = None then
err "line %d: %S appears before any [section] header" n line