Files
klammertext/sks/kutil/kutil.k
Andy Kopra 2ba7ceee7a Initial commit: Klammertext source distribution
Curated source subset assembled by klammertext-dev's doc/make_dist.sh: the Klammermachine (mac), the Standard Klammer Set (sks), the commands (com), editor plugins and install guides (doc), a test subset (tst), and lib/bin placeholders. Builds with 'make -C com'.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-18 19:32:38 +02:00

64 lines
1.7 KiB
Plaintext

@@show s : @eval :cpp show show @ @@
@@caption_arguments :
:caption
:number.bool true
:caption_side.side bottom
:caption_font.font i
:caption_font_size.float .9
@@
@@reference spec | name :
__REF__*spec*__*name*__
@@
@@@argtype number | a number
:pattern 'float'^|'int'
:python_cast (lambda s: float(s))
@@@
@@@argtype length | a length specifier
#:pattern f^|none^|'float'w^|'float'h^|'int'px^|'float'em^|'int'pt
# The last pattern is a string, used where possible to determine its length
:pattern f^|none^|'float'w^|'float'h^|'int'px^|'float'em^|'int'pt^|"[^^"]+"^|'float'pw^|'float'ph
# :python_cast (lambda s : __import__("kutil").parse_length("tex", s))
@@@
@@@argtype lengths | a list of lengths
:pattern ('length'^|\s+)*
#:python_cast (lambda s : [__import__("kutil").parse_length("tex", e) for e in s.split()])
@@@
@@@argtype side | a side of a box
:pattern top^|right^|bottom^|left
@@@
@@@argtype hpos | horizontal position
:pattern left^|center^|right^|none
@@@
@@@argtype figure_id |
an identifier for a figure.
The identifier can be in one of six forms:
before
before <offset-to-figure>
after
after <offset-to-figure>
<image-basename>
<id>
The "before" value means the figure before this place in the text;
the number indicates the number of figures behind that place in the
text. This means that "before" is equivalent to "before 1". The
"after" value uses an offset in the same way but counting forewards.
For images, the <image-basename> argument is the basename argument to
the ^@image klammer and can be used as an identifier.
An <id> is the value of the ^:id argument for an image.
^:pattern before(?^:\s+\d+)?^|after(?^:\s+\d+)?^|[-\w]+
@@@