Width and height argtypes, kdesc --argtypes from ref/, txt @define/@left_right/@columns, kdiag --check value validation (from dev d6993110e9b3)
Also: the klammertext argtype (descriptions kept as source), txt table wrapping and :hpos/:offset, @c between ‹ ›, txt section headings, the ktext newline-only trim, capitalize(), and the argtype test suite. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
9b0d0d7897
commit
0ead40f272
39 files changed
+734
-158
No files matched your search
+18
-13
@@ -51,10 +51,12 @@ shows as `name.type default`, an option as `:name.type default`.
|
||||
kdiag --process --check doc.kt
|
||||
```
|
||||
|
||||
reports every klammer application whose name, argument count, option names, or
|
||||
target coverage is wrong — including inside `@cond` branches this render will
|
||||
not take and inside klammer bodies never applied. It applies nothing. Use it
|
||||
before claiming a document is correct.
|
||||
reports every klammer application whose name, argument count, option names,
|
||||
target coverage, or **literal argument value** is wrong (a value that fails
|
||||
its argument type, such as `:width .5h`) — including inside `@cond` branches
|
||||
this render will not take and inside klammer bodies never applied. A value
|
||||
holding a nested klammer or a `*variable*` is computed at run time and is not
|
||||
judged. It applies nothing. Use it before claiming a document is correct.
|
||||
|
||||
**Inspect how text is parsed:** `kdiag --type '<text>'` shows the katoms and
|
||||
their types; `kdiag --args '<text>'` shows how text splits into arguments;
|
||||
@@ -227,8 +229,8 @@ which reads `kt/preface.kt`, `kt/one.kt`, `kt/two.kt` beside the root file.
|
||||
ktext doc.kt -t pdf # also: -t html, -t tex
|
||||
ktext doc.kt -t html # writes a DIRECTORY doc/ containing index.html (+css, fonts, js)
|
||||
ktext doc.kt -t txt -d # -d displays on stdout instead of writing -- but this
|
||||
# example errors under txt/ansi: @c and @image have no
|
||||
# txt definition (§5), and coverage is never silently degraded
|
||||
# example errors under txt/ansi: @image has no txt
|
||||
# definition (§5), and coverage is never silently degraded
|
||||
ktext -s '@i-x' -t html -d # -s takes a string; no file needed
|
||||
ktext doc.kt -s '@@version : 3.2.1 @@' -t pdf # -s is processed BEFORE the files:
|
||||
# define a klammer the document uses
|
||||
@@ -274,11 +276,12 @@ Bar depth is the dimension: one `|` separates items, two `||` separates rows.
|
||||
Argument order is free for options, fixed for positionals.
|
||||
|
||||
**Coverage today** (`kdesc --coverage`; 89 klammers): html, tex and pdf cover
|
||||
nearly all. **txt and ansi cover 37**, among them `@b @i @t @u @s @r @ri @ts
|
||||
nearly all. **txt and ansi cover 40**, among them `@b @i @t @u @s @r @ri @ts
|
||||
@typeface`, `@s1`–`@s7`, `@par @newpage @vspace @vfill @nl`, `@indent @right
|
||||
@lines @qa`, `@ul @ol`, `@table @tbl @reference`, `@footnote @link`, `@date
|
||||
@datetime`. Not for txt: `@c @code @source_listing @image @image_grid @quote
|
||||
@note @center @block @columns @multicolumn @define @sup @sub @color @h1`–`@h7`.
|
||||
@lines @qa`, `@ul @ol`, `@table @tbl @reference @define @left_right`,
|
||||
`@footnote @link`, `@date @datetime`, `@c`. Not for txt: `@code
|
||||
@source_listing @image @image_grid @quote @note @center @block @columns
|
||||
@multicolumn @sup @sub @color @h1`–`@h7`.
|
||||
`@u` has no html definition. A klammer applied under a target that lacks it is
|
||||
an **error**, never silently dropped.
|
||||
|
||||
@@ -328,7 +331,7 @@ the range (here: one sum per column).
|
||||
| `html` | a directory `<name>/` with `index.html`, `css/`, `fonts/`, `js/` | self-contained, fonts localized; `book` structure adds navigation, search |
|
||||
| `tex` | `<name>.tex` | XeLaTeX source; fonts via fontspec from the font store |
|
||||
| `pdf` | `<name>.pdf` | `tex` plus a xelatex run (TeX Live required) |
|
||||
| `txt` | `<name>.txt` | plain text filled to `Target_txt_width` (72), blocks indented by `Target_txt_indent` (3); tables ruled and padded; captions numbered; **37 of 89 klammers** (§5) |
|
||||
| `txt` | `<name>.txt` | plain text filled to `Target_txt_width` (72), blocks indented by `Target_txt_indent` (3); tables ruled and padded; captions numbered; **40 of 89 klammers** (§5) |
|
||||
| `ansi` | txt + SGR escape sequences | `@b`/`@i`/`@u` and table header styles shown by a terminal; **identical to txt once the escape sequences are stripped**; pick it with `-t ansi -d`; a terminal needs a font with an italic face (macOS Terminal: Menlo, not Monaco) |
|
||||
|
||||
`k`, `o`, `*` also appear in `kdesc -t`: they are declaration pseudo-targets
|
||||
@@ -368,7 +371,9 @@ ones. CJK is deliberately not shipped.
|
||||
- Separators: `:` create, `::` create inheriting parameters, `:::` override an
|
||||
existing definition, `::::` define a default a later `:` may replace.
|
||||
- Argument types: `name.type` — `string` (default), `int`, `float`, `bool`,
|
||||
`list`, `length`, `literal` (raw content, named close required), `rest`
|
||||
`list`, `width`/`height` (a bare number = characters / lines in every
|
||||
target; units `em pt px`, `w pw` for widths, `h ph` for heights; the axes
|
||||
are checked), `literal` (raw content, named close required), `rest`
|
||||
(everything left, bars included; `rest(2)` = list of lists), and any
|
||||
`@@@argtype` the klammerset declares (`kdesc --argtypes`). An argtype may
|
||||
carry `:default` and `:alone`; a klammer may override the default, never the
|
||||
@@ -451,7 +456,7 @@ ones. CJK is deliberately not shipped.
|
||||
`-c`/`-u` render through `ansi` on a terminal and `txt` in a pipe.
|
||||
|
||||
**When something is wrong:** `kdiag --process --check doc.kt` first (name,
|
||||
arity, option and coverage faults without rendering); then `kdesc -k <klammer>`
|
||||
arity, option, literal-value and coverage faults without rendering); then `kdesc -k <klammer>`
|
||||
against what was written; then `kdiag --type '<fragment>'` if the question is
|
||||
how something is parsed; then `ktext … -v 1` if the question is which file or
|
||||
klammerset was used.
|
||||
|
||||
Reference in new issue
Block a user