katom types from ref/ in groups, @table :leading in lines of text and :rulesep, @code under txt, one table style attribute, literal-klammer options (from dev 2e453744f5e9)

kdesc --katoms is Klammertext rendered from ref/, the types in titled groups,
with --katoms full for the regex column.  @table :leading L is L lines of the
surrounding text in html as in pdf (default 1), and :rulesep spaces the
horizontal rules.  The html table has one style attribute, so :column_width
fractions take effect again.  @code and @source_listing render in plain
text; captions are numbered per kind there, and a table needs no blank line
around it.  @c takes :nd, and an option-shaped word before a bar inside
literal code is code.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
ackandClaude Fable 5.1 committed 2026-09-21 22:37:13 +02:00
1 parent 63956c00e5
commit 217c0f3fc5
23 files changed
+625 -290

No files matched your search

+30
View File
@@ -181,6 +181,36 @@ check_eq "25. a real literal klammer still works after a comment naming it" \
'[x]' --klammersets none -t t -s "$T $LIT # mentions @lit here
@lit x lit@"
echo
echo "-- 25a-e: only a DECLARED option name opens an option region --"
# The content of a literal klammer begins after the bar that follows its
# options. ANY ":word" before a bar counted as an option until 2026-09-20,
# declared or not, so code holding one ("ls :w | wc", a regex's "(?:a|b)")
# lost everything up to the bar to an option region and the file failed with
# 'Optional argument ":w" not defined' -- an error about an option the author
# never wrote, in content promised to be read as nothing but text.
# OPT declares one option, :flag, so both directions can be asserted.
OPT='@@opt.k :flag.bool | t.literal : A literal klammer with an option @@ @@opt.t :: [*flag*/*t*] @@'
OPTUSE=$(mktemp /tmp/escape_opt.XXXXXX).kt
opt_case() { # opt_case NAME EXPECTED USE
printf '%s\n' "$3" > "$OPTUSE"
check_eq "$1" "$2" "$OPTUSE" --klammersets none -t t -d -s "$T $OPT"
}
opt_case "25a. an UNDECLARED :name before a bar is content" \
'[/x :y | z]' '@opt x :y | z opt@'
opt_case "25b. ... as is a regex's (?:a|b)" \
'[/(?:a|b)]' '@opt (?:a|b) opt@'
opt_case "25c. a DECLARED option still opens the option region" \
'[true/x]' '@opt :flag | x opt@'
opt_case "25d. ... and after its bar an undeclared :name is content again" \
'[true/x :y | z]' '@opt :flag | x :y | z opt@'
# The one ambiguity left, and the author's way out of it: a name the klammer
# DOES declare, written inside the code before a bar, is an option -- unless
# an option region has already been written, which ends at ITS bar.
opt_case "25e. a declared name in the code is content once the options are written" \
'[false/x :flag | z]' '@opt :flag false | x :flag | z opt@'
rm -f "$OPTUSE"
rm -f "$ERR"
echo