Escaping, table layout, and document fixes

Quoted Klammertext specials (^@ ^| ^# ^^ ^: ^*) and ^'...'^ regions now
survive re-processing (held as escape markers until final output);
:after_apply phase functions receive and return raw target text.

Tables: :hpos element position (center|left|right|<length>) replaces the
unimplemented :center/:indent; the ranged cell override is renamed
:justify; :column_width works in html (colgroup widths) and gains
'fill' -- the remaining width, capped at the column's widest entry, in
both targets; a table wider than the text column warns on the console;
table edges without an outer line set their text flush on the margins.

@document: no empty title bar for untitled documents; @vfill fills to
the bottom of the window in html (pure CSS); @vspace in plain text;
new @dot klammer; monospace email links.
This commit is contained in:
2026-07-25 21:16:21 +02:00
parent 4262fc6136
commit d61336b191
26 changed files with 650 additions and 75 deletions

View File

@@ -30,11 +30,16 @@
@@@argtype column_width |
width of the table columns. Each column is one of 'fit' (widest line of the
cells in that column), a fraction 0.0->1.0 (that fraction of the total table
width), or '*' (use the remaining width of the table; there can only be one
column with '*'). If there are fewer positions than columns in the table, the
last value is repeated. Extra positions generate a warning.
:pattern (fit^|f^|0?\.\d+^|\*^|\s+)+
cells in that column), 'fill' (the remaining width of the table after the
other columns, but no more than the column's widest line -- the table stops
growing once nothing needs a line break), a fraction 0.0->1.0 (that
fraction of the total table width), or '*' (the remaining width,
unconditionally -- the table always spans the full width). Several 'fill'
columns divide the remaining width in proportion to their widest lines;
'fill' cannot be combined with a fraction or '*'. If there are fewer
positions than columns in the table, the last value is repeated. Extra
positions generate a warning.
:pattern (fill^|fit^|f^|0?\.\d+^|\*^|\s+)+
:python_cast (lambda s : s.split())
:default fit
@@@
@@ -154,15 +159,15 @@
:default period
@@@
@@@argtype table_hpos |
cell position overrides, as one or more <cells> <position> pairs
@@@argtype table_justify |
cell justification overrides, as one or more <cells> <position> pairs
separated by semicolons (the same list style as ^:calc). <cells> is an
indexed_range selecting cells; <position> is l, c, or r and overrides
the column position given by ^:cell_hpos for those cells. A colspan
anchor's override positions the whole merged cell. For example,
the column justification given by ^:cell_hpos for those cells. A colspan
anchor's override justifies the whole merged cell. For example,
"-3--1(3) r" right-justifies the cells in column 3 of the last three
rows.
# Coarse check ("<cells> <position>" pairs); hpos_overrides() in
# Coarse check ("<cells> <position>" pairs); justify_overrides() in
# table.py validates the range and position.
:pattern \s*([^^\s;]+\s+[lcr]\s*(;\s*^|\s*$))+
@@@
@@ -188,8 +193,7 @@
@@table rows.rest(2)
:id
@caption_arguments@
:center.bool true
:indent.length 1em
:hpos.element_hpos
:header.bool true
:allow_break.bool false
:column_width.column_width
@@ -197,7 +201,7 @@
:vline.table_vline
:grid.bool false
:cell_hpos.cell_hpos
:hpos.table_hpos
:justify.table_justify
:header_font.font i
:font.font_list
:colspan.table_span