diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-08-19 11:35:13 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-08-19 11:35:13 +0200 |
| commit | a9464100bb02d74c90d585f8334f449b1fefa9d7 (patch) | |
| tree | 9f70fda32e14c3204895b6f48d1f479283e24bad /templates | |
| parent | 717a6c2032d0df3669333dd52f993e8f84563bc2 (diff) | |
| download | colitur-a9464100bb02d74c90d585f8334f449b1fefa9d7.tar.gz colitur-a9464100bb02d74c90d585f8334f449b1fefa9d7.zip | |
fix(templates): grid.ms wall calendar dropped four of seven columns
pdftotext -layout of the shipped grid.ms showed only 3-4 of 7 columns and
roughly a third of each month's day numbers: tbl's plain columns (no
w()) size to their widest single entry and never wrap, so a long
fallback slug (some run past 40 characters) forced every column that
wide, the table ran far past the page, and whatever fell past the
physical edge was gone, not merely ugly. groff exited 0 throughout
(warnings, not errors), so make check-templates reported OK on a broken
artefact.
Fixed both halves. (a) The table now fits: true landscape via gropdf's
own -P-pa4l (an in-document Xpapersize=a4l escape was tried and
rejected -- it does not rotate the page in this groff), ms's own title
macro widened back out after narrowing the line length for the title
text (a second, independent way the original lost its width, found by
reading s.tmac), and every column rewritten as a genuine tbl text-block
(T{/T}, not a plain w() cell -- w() alone does not wrap, confirmed
against tbl's own generated troff code) so long, hyphenated slugs wrap
at their own hyphens instead of forcing the column wider. (b)
check-templates now captures groff's stderr per template and fails the
target if it is non-empty, rather than trusting groff's exit code.
Verified: 0 warnings (was 12), pdftotext -layout shows all 7 columns and
every day number for all 12 months (was 3-4 columns, ~12-23 of each
month's day numbers). The golden fixture is regenerated: 0 "{{", 12
month headings, exactly one Ianuarius, and each week's block (now spread
across several physical lines by the T{/T} wrap) carries exactly 6 tabs
joining its 7 cells.
Diffstat (limited to 'templates')
| -rw-r--r-- | templates/ef/grid.ms | 78 |
1 files changed, 74 insertions, 4 deletions
diff --git a/templates/ef/grid.ms b/templates/ef/grid.ms index 0ec2fb3..703f46b 100644 --- a/templates/ef/grid.ms +++ b/templates/ef/grid.ms @@ -1,5 +1,67 @@ .\" colitur wall calendar -- groff ms with tbl. flavour: groff -.\" Build: colitur table --year 2027 --template grid.ms | groff -ms -t -Tpdf > grid.pdf +.\" Build: colitur table --year 2027 --template grid.ms | groff -ms -t -Tpdf -P-pa4l > grid.pdf +.\" +.\" LANDSCAPE, not the ms default portrait: with allbox cells and Latin-less +.\" days falling back to the raw slug (some fallback slugs run past 40 +.\" characters, e.g. "commemoration-of-the-baptism-of-the-lord"), seven +.\" columns of real content do not fit a portrait line length at any +.\" reasonable point size. "-P-pa4l" is gropdf's own landscape papersize +.\" (groff_font(5): a trailing "l" on a papersize name swaps width/height at +.\" the OUTPUT DEVICE level) -- it must be a command-line flag, not a request +.\" inside this file: an in-document "\X'papersize=a4l'" escape was tried and +.\" rejected (it does not actually rotate gropdf's page in this groff, and +.\" throws diagnostics doing it). ".pl"/".po"/".ll" below independently widen +.\" TROFF's OWN idea of the page to match -- ".pl"/".ll" are requests, unlike +.\" the device's own physical page size, and are not implied by "-P-pa4l" -- +.\" so both halves are needed, or one side clips the other. +.\" +.\" ".TL" (the ms title macro, s.tmac) ITSELF narrows the line length to +.\" 5/6 of register "LL" for the title text, and never widens it back +.\" afterward -- there is no third place in s.tmac that ever does. Setting +.\" only the primitive ".ll" before ".TL" is therefore not enough: ".TL" +.\" overwrites it and every table for the rest of the document inherits +.\" the NARROWED value, silently, which is a second, independent way the +.\" original template lost its width (found by reading s.tmac itself, not +.\" guessed). Fixed by setting register "LL" (what ".TL" actually reads) +.\" and re-asserting ".ll" once more, explicitly, right after the title. +.\" +.\" Every column is a FIXED-WIDTH, WRAPPING tbl "w()" block, not a plain "l": +.\" without "w()" tbl sizes a column to its single widest entry and does NOT +.\" wrap, so a 40-character slug forces every column that wide -- seven of +.\" them together run far past any line length, tbl warns "table wider than +.\" line length", and whatever falls past the physical page edge is not a +.\" rendering nicety missing, it is GONE: `pdftotext -layout` (and a printed +.\" page) show only however many columns fit, not all seven. "w()" makes +.\" each column wrap its own text block instead, the same fix grid.tex +.\" already uses via LaTeX's "p{2.6cm}" (see that file's own comment) -- +.\" this is the tbl-native equivalent, not a different design. +.\" +.\" "w()" alone is NOT sufficient, and this is the part that actually cost +.\" the time: tbl only wraps a cell as a text block when its content is +.\" delimited by "T{"/"T}" on their own lines. A PLAIN cell entry in a +.\" "w()" column (what the first attempt at this fix used) is never +.\" wrapped at all -- tbl just widens the column past the requested "w()" +.\" to fit the single longest unbroken entry, exactly reproducing the +.\" original bug. Confirmed directly against tbl's own generated troff +.\" code (`tbl grid.ms`, grep "3w0 .*>?"): every column width register is +.\" `max(w(), \w'cell text')`, so an un-delimited 40-character cell always +.\" wins that max. Every day cell below is therefore its own "T{"/"T}" +.\" block; the closing "T}" and the following column's opening "T{" share +.\" one line with the tab between them (the standard tbl idiom: "T}<TAB> +.\" T{"). The template writes that as "{{#last}}T}{{/last}}{{^last}}T} +.\" <TAB>{{/last}}" rather than "T}{{^last}}<TAB>{{/last}}T{" so that no +.\" literal "T{" ever sits directly against a "{{"/"}}" delimiter in the +.\" source -- three braces in a row there parses as a malformed tag, not +.\" as literal text followed by a tag. +.\" +.\" ".na" (no-adjust, ragged right) is required alongside the wrap, not +.\" cosmetic: a hyphenated slug like "commemoration-of-the-baptism-of-the- +.\" lord" DOES break at its own hyphens once wrapping is active (verified: +.\" troff's filler treats an ASCII hyphen as a break point), but adjusted +.\" (justified) fill in a column this narrow cannot always stretch such a +.\" line to the full measure and troff warns "cannot adjust line" for +.\" every such row -- another warning `make check-templates` must fail on. +.\" Ragged-right removes the stretching, not the wrapping. .\" .\" Day label falls back to the slug when the day carries no Latin name (most .\" temporal days, and most sanctoral entries, which are Latin-less in the @@ -10,16 +72,24 @@ .\" Every cell also carries a last flag, true on the seventh of its row: tbl .\" needs the tab separator BETWEEN columns, not after the last one, and the .\" engine has no unless-last construct, so the flag comes from data. +.pl 8.27i +.po 0.3i +.nr LL 10.9i +.ll \n[LL]u .TL Calendarium {{year}} \(bu {{rite}} +.ll \n[LL]u +.na {{#months}} .SH {{name.la}} .TS allbox; -c c c c c c c -l l l l l l l. +cw(1.3i) cw(1.3i) cw(1.3i) cw(1.3i) cw(1.3i) cw(1.3i) cw(1.3i) +lw(1.3i) lw(1.3i) lw(1.3i) lw(1.3i) lw(1.3i) lw(1.3i) lw(1.3i). Dom Lun Mar Mer Iov Ven Sab -{{#weeks}}{{#days}}{{#in_month}}{{dom}} {{#name}}{{la}}{{^la}}{{slug}}{{/la}}{{/name}}{{/in_month}}{{^last}} {{/last}}{{/days}} +{{#weeks}}{{#days}}T{ +{{#in_month}}\fB{{dom}}\fP \s-2{{#name}}{{la}}{{^la}}{{slug}}{{/la}}{{/name}}\s+2{{/in_month}} +{{#last}}T}{{/last}}{{^last}}T} {{/last}}{{/days}} {{/weeks}}.TE {{/months}} |
