summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-08-19 22:00:20 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-08-19 22:00:20 +0200
commitd72868ab9ea4f3170eff22a731fdc171469eddf7 (patch)
tree77b43e8c4e84e38675c1d8a36e2d501a0d994bcc /templates
parentceed38372a66580ec584db10db79cf311c6da9ef (diff)
downloadcolitur-d72868ab9ea4f3170eff22a731fdc171469eddf7.tar.gz
colitur-d72868ab9ea4f3170eff22a731fdc171469eddf7.zip
feat(templates): the wall calendar fills its page
The previous version occupied about the top quarter of an A4 page and left the rest blank, and printed slugs. Cell height is now computed from the text height (\textheight-18mm over 6 rows -- every month has 5 or 6 Sunday-started weeks) rather than left to the table's natural size, which is what made it float at the top. Measured: January 2027's last row of content now reaches y=566pt of a 595pt-tall page, not a quarter of the way down. Real names replace the raw slug in every cell (the observed day's own resolved display name, a plain string per View.of_days), and each day's rank name is shown too, so a printed page reads as a calendar rather than machine keys. Weekday headings come from the view as a localised list rather than a hard-coded Dom/Lun/Mar row, so a translated calendar needs no template edit -- and because the engine rejects an empty tag path, the list carries named {name; last} fields rather than bare values. grid.ms and grid.html carry the same two changes (real names, localised weekday headings) for their own flavours. Verified with pdflatex/groff: 12 pages, A4 landscape, every row exactly 7 cells (6 ampersands), zero warnings. Goldens regenerated through the test harness's own render path, not the CLI, whose default language table differs from the test's.
Diffstat (limited to 'templates')
-rw-r--r--templates/ef/grid.html20
-rw-r--r--templates/ef/grid.ms22
-rw-r--r--templates/ef/grid.tex75
3 files changed, 77 insertions, 40 deletions
diff --git a/templates/ef/grid.html b/templates/ef/grid.html
index b92e14a..b6ed229 100644
--- a/templates/ef/grid.html
+++ b/templates/ef/grid.html
@@ -1,11 +1,11 @@
<!-- colitur wall calendar -- HTML. flavour: html -->
-<!-- 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 shipped data) -- see ordo.tex's own comment for why the fallback
- is written as a name-section wrapping a plain var and its inverse,
- rather than a single dotted lookup and its inverse: the enclosing month
- object also carries its own name.la, and a dotted lookup that misses
- climbs the WHOLE path to that outer scope instead of falling back. -->
+<!-- The observed day's own display name is a PLAIN resolved string
+ (View.of_days, Task 5), not a lang-keyed object -- there is no
+ dotted-la-with-slug-fallback idiom to write here any more (see
+ ordo.html's own header comment for the full reasoning).
+ The weekday header row comes from the view's own top-level
+ weekday_headings list (name/last objects), not a hard-coded
+ Dom/Lun/Mar row, so a translated calendar needs no template edit. -->
<!doctype html>
<html lang="la"><head><meta charset="utf-8">
<title>Calendarium {{year}}</title>
@@ -24,10 +24,10 @@
<h1>Calendarium {{year}} &middot; {{rite}}</h1>
{{#months}}
<table>
- <caption>{{name.la}}</caption>
- <tr><th>Dom</th><th>Lun</th><th>Mar</th><th>Mer</th><th>Iov</th><th>Ven</th><th>Sab</th></tr>
+ <caption>{{name}}</caption>
+ <tr>{{#weekday_headings}}<th>{{name}}</th>{{/weekday_headings}}</tr>
{{#weeks}}<tr>
- {{#days}}{{#in_month}}<td class="{{colour}}"><span class="dom">{{dom}}</span>{{#name}}{{la}}{{^la}}{{slug}}{{/la}}{{/name}}</td>{{/in_month}}{{^in_month}}<td class="pad"></td>{{/in_month}}{{/days}}
+ {{#days}}{{#in_month}}<td class="{{colour}}"><span class="dom">{{dom}}</span>{{name}}</td>{{/in_month}}{{^in_month}}<td class="pad"></td>{{/in_month}}{{/days}}
</tr>
{{/weeks}}
</table>
diff --git a/templates/ef/grid.ms b/templates/ef/grid.ms
index 703f46b..2244815 100644
--- a/templates/ef/grid.ms
+++ b/templates/ef/grid.ms
@@ -63,11 +63,17 @@
.\" 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
-.\" shipped data) -- see ordo.tex's own comment for why the fallback is
-.\" written as a name-section wrapping a plain var and its inverse, rather
-.\" than a single dotted lookup and its inverse.
+.\" The observed day's own display name is a PLAIN resolved string
+.\" (View.of_days, Task 5), not a lang-keyed object -- there is no
+.\" dotted-la-with-slug-fallback idiom to write here any more (see
+.\" ordo.ms's own header comment for the full reasoning).
+.\"
+.\" The weekday header row comes from the view's own top-level
+.\" weekday_headings list (name/last objects), not a hard-coded Dom/Lun/Mar
+.\" row -- the same localisation reasoning as grid.tex's own header
+.\" comment, and the same reason it cannot be a bare current-value
+.\" reference: this engine rejects an empty tag path as a parse error, so a
+.\" loop over this list must name a field on each heading object.
.\"
.\" 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
@@ -82,14 +88,14 @@ Calendarium {{year}} \(bu {{rite}}
.na
{{#months}}
.SH
-{{name.la}}
+{{name}}
.TS
allbox;
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
+{{#weekday_headings}}{{name}}{{^last}} {{/last}}{{/weekday_headings}}
{{#weeks}}{{#days}}T{
-{{#in_month}}\fB{{dom}}\fP \s-2{{#name}}{{la}}{{^la}}{{slug}}{{/la}}{{/name}}\s+2{{/in_month}}
+{{#in_month}}\fB{{dom}}\fP \s-2{{name}}\s+2{{/in_month}}
{{#last}}T}{{/last}}{{^last}}T} {{/last}}{{/days}}
{{/weeks}}.TE
{{/months}}
diff --git a/templates/ef/grid.tex b/templates/ef/grid.tex
index 51432e9..8f90372 100644
--- a/templates/ef/grid.tex
+++ b/templates/ef/grid.tex
@@ -1,35 +1,66 @@
-% colitur wall calendar -- LaTeX. flavour: latex
+% colitur wall calendar -- A4 landscape, one month per page. flavour: latex
% Build: colitur table --year 2027 --template grid.tex > grid.tex && pdflatex grid.tex
+% This template has no table of contents and no cross-references (unlike
+% ordo.tex), so a single pdflatex pass is enough -- there is nothing for a
+% second pass to resolve.
%
-% 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
-% shipped data). The fallback is written as a name-section wrapping a plain
-% var and its inverse, deliberately NOT as a single dotted-path lookup
-% followed by its own inverse: a dotted lookup that misses climbs to the
-% enclosing scope for the WHOLE path, and the month object also carries a
-% same-named key one level up, so the naive form would render the month's
-% own Latin name on every day lacking one, and never fall back at all.
+% The grid must FILL the page, not sit in its top quarter: \arraystretch
+% alone only pads a row's NATURAL height, it cannot make a table taller
+% than its own content wants to be, which is exactly why the previous
+% version floated at the top with the rest of the page blank. The fix is
+% to compute an explicit row height from the text height itself (\cellh
+% below) and give every cell a fixed-height parbox of that size, so the
+% table's total height is dictated by the page, not by its content. Every
+% month in the 1583-9999 domain has either 5 or 6 Sunday-started weeks
+% (never fewer), so dividing the available height by 6 fills at least 5/6
+% of it on a 5-week month and all of it on a 6-week one -- never a quarter.
%
-% Every cell also carries a last flag, true on the seventh of its row: the
-% engine has no unless-last construct, so the separator BETWEEN cells comes
-% from data, not the template. A trailing separator on every cell would give
-% eight columns for seven and pdflatex would reject the file outright.
-\documentclass[10pt,landscape]{article}
+% Real names, not slugs: the observed day's own display name is a PLAIN
+% resolved string (View.of_days, Task 5), interpolated directly as a plain
+% var below -- there is no dotted-la-with-slug-fallback idiom left to
+% write (see ordo.tex's own header comment for the full reasoning; it
+% applies here unchanged).
+%
+% The weekday header row comes from the view's top-level weekday_headings
+% list (name/last objects), not a hard-coded "Dom Lun Mar" row: the engine
+% rejects an EMPTY tag path -- a bare dot inside a section, on its own --
+% as a parse error, so the loop below must name a field on each heading
+% object rather than interpolate the section's own value directly, and a
+% hard-coded row would not be localised anyway. Every cell (day and
+% heading alike) also carries a last flag, true on the seventh of its row:
+% a LaTeX table row needs the ampersand separator BETWEEN cells, not after
+% the last one, and the engine has no unless-last construct, so the flag
+% is data -- rendered only when NOT last. A trailing ampersand gives eight
+% columns for seven cells and pdflatex rejects the file outright.
+\documentclass[11pt,landscape]{article}
\usepackage[a4paper,margin=10mm]{geometry}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[table]{xcolor}
-\definecolor{lwhite}{HTML}{FFFFFF}\definecolor{lred}{HTML}{FFDDDD}
-\definecolor{lgreen}{HTML}{DDFFDD}\definecolor{lviolet}{HTML}{EEAAEE}
-\definecolor{lrose}{HTML}{FFDDEE}\definecolor{lblack}{HTML}{DDDDDD}
+\usepackage{array}
+\definecolor{cwhite}{HTML}{FFFFFF}
+\definecolor{cred}{HTML}{F8DCDC}
+\definecolor{cgreen}{HTML}{DDEEDD}
+\definecolor{cviolet}{HTML}{E6DAF0}
+\definecolor{crose}{HTML}{FADCE8}
+\definecolor{cblack}{HTML}{DCDCDC}
+\setlength{\parindent}{0pt}
+\pagestyle{empty}
+% Seven equal columns filling the text width, and rows stretched so six
+% possible week rows fill the text height -- see the header comment above
+% for why a fixed row height, not \arraystretch, is what makes this work.
+\newlength{\cellw}\setlength{\cellw}{\dimexpr(\textwidth-14\tabcolsep-8\arrayrulewidth)/7\relax}
+\newlength{\cellh}\setlength{\cellh}{\dimexpr(\textheight-18mm)/6\relax}
+\newcommand{\daycell}[3]{\parbox[t][\cellh][t]{\cellw}{\raggedright\textbf{#1}\ \footnotesize #2\par\vfill\tiny #3}}
\begin{document}
{{#months}}
-\section*{ {{name.la}} {{year}} }
-\begin{tabular}{|p{2.6cm}|p{2.6cm}|p{2.6cm}|p{2.6cm}|p{2.6cm}|p{2.6cm}|p{2.6cm}|}
-\hline Dom & Lun & Mar & Mer & Iov & Ven & Sab \\ \hline
-{{#weeks}}{{#days}}{{#in_month}}\cellcolor{l{{colour}}}\textbf{ {{dom}} } \footnotesize {{#name}}{{la}}{{^la}}{{slug}}{{/la}}{{/name}}{{/in_month}}{{^last}} & {{/last}}{{/days}} \\ \hline
+{\LARGE\bfseries {{name}} {{year}}}\par\vspace{2mm}
+\renewcommand{\arraystretch}{1}
+\begin{tabular}{|*{7}{p{\cellw}|}}\hline
+{{#weekday_headings}}\textbf{ {{name}} }{{^last}} & {{/last}}{{/weekday_headings}} \\ \hline
+{{#weeks}}{{#days}}{{#in_month}}\cellcolor{c{{colour}}}\daycell{ {{dom}} }{ {{name}} }{ {{rank_name}} }{{/in_month}}{{^last}} & {{/last}}{{/days}} \\ \hline
{{/weeks}}
\end{tabular}
-\newpage
+\clearpage
{{/months}}
\end{document}