diff options
| author | Paul Buetow <paul@buetow.org> | 2026-06-16 22:34:54 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-06-16 22:34:54 +0300 |
| commit | 0eccf41ff404029bd6f39f06b0a14f1643ddbdda (patch) | |
| tree | 8061b05280f5a4b75896e4f35a5d12d56a2baaae /src/lib/template.source.sh | |
| parent | 14d041e890765afbab396a29871d6bf6e8097fff (diff) | |
wn0 batch preview-thumbnail rendering per page
Each thumbnail on a preview page (page-N.html) used to be rendered by its
own "template preview" call, paying the full source_template_file cost --
an "env -i bash" invocation -- per thumbnail. With MAXPREVIEWS thumbnails
per page that was N template renders per page just for the grid.
render_full_preview_page now builds the markup for ALL of a page's
thumbnails in bash (build_preview_thumbnail / append_preview_thumbnail)
and emits the whole grid in ONE render via a new previewpage.tmpl that
takes the pre-built HTML through a context_raw "preview_thumbs" field --
the same pattern the stats filter galleries (camera.tmpl) already use.
Per-thumbnail markup is byte-identical to the old preview.tmpl output:
same <a name=... href=...><img class='thumb <anim>' .../></a> structure,
order, HTML escaping and seeded "slow" animation class. Header and footer
stay as their own template calls, so a page now costs ~1 previewpage
render + header/footer instead of N + chrome.
The parallel job-pool integration and failure contract are unchanged:
each preview page is still one background render job. Added the
render_preview_thumbs_html field spec (hn0 dispatch pattern, context_raw
kind), registered previewpage in the validate_template_dir required
templates and in the required-context-vars test expectations, and pointed
the four generation template-failure tests at previewpage.tmpl (generation
no longer renders preview.tmpl). The standalone "template preview" engine
unit tests keep exercising preview.tmpl, which still ships.
Verified byte-identical output: generated the fixture album (including a
spaces/special-char filename) twice with RANDOM_SEED=42 using the parent
commit's bin/shuriken vs the new bin; every .html file is identical.
just test, just shellcheck, just check-generated and git diff --check all
pass.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'src/lib/template.source.sh')
| -rw-r--r-- | src/lib/template.source.sh | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/lib/template.source.sh b/src/lib/template.source.sh index 13a2988..cd44a45 100644 --- a/src/lib/template.source.sh +++ b/src/lib/template.source.sh @@ -165,6 +165,7 @@ declare -ra TEMPLATE_RENDER_FIELD_SPECS=( 'render_photos_dir_html|context_html|photos_dir|photos_dir|splash details view' 'render_prev_html|context_html|prev|prev|prev' 'render_preview_num_html|context_html|preview_num|preview_num|preview details view' + 'render_preview_thumbs_html|context_raw|preview_thumbs|preview_thumbs|previewpage' 'render_redirect_page_html|context_html|redirect_page|redirect_page|redirect' 'render_show_header_bar|context_raw|show_header_bar|show_header_bar|header' 'render_stats_body_html|context_raw|stats_body|stats_body|stats' |
