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 /tests/cli.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 'tests/cli.sh')
| -rwxr-xr-x | tests/cli.sh | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/cli.sh b/tests/cli.sh index fdd2cec..f7ad977 100755 --- a/tests/cli.sh +++ b/tests/cli.sh @@ -3780,7 +3780,7 @@ test_generate_template_failure_preserves_dist() { PATH="$fake_bin:$PATH" \ test::generate_fixture_images "$TEST_TMPDIR/incoming" cp -R "$TEST_REPO_ROOT/share/templates/default" "$template_dir" - printf 'return 42\n' > "$template_dir/preview.tmpl" + printf 'return 42\n' > "$template_dir/previewpage.tmpl" mkdir -p "$TEST_TMPDIR/dist" printf 'old index\n' > "$TEST_TMPDIR/dist/index.html" test::write_album_config \ @@ -3794,7 +3794,7 @@ test_generate_template_failure_preserves_dist() { test::capture_failure_output "$TEST_SHURIKEN" --generate ) - test::assert_contains 'Rendering preview template into ' "$output" + test::assert_contains 'Rendering previewpage template into ' "$output" test "$(<"$TEST_TMPDIR/dist/index.html")" = 'old index' test::assert_path_absent "$TEST_TMPDIR/dist/photos/01-landscape.jpg" test::assert_path_absent "$TEST_TMPDIR/dist/shuriken.json" @@ -3819,7 +3819,7 @@ test_generate_templates_cannot_read_generation_locals() { cp -R "$TEST_REPO_ROOT/share/templates/default" "$template_dir" # shellcheck disable=SC2016 printf 'printf "legacy num: %%s\\n" "${num}"\n' \ - > "$template_dir/preview.tmpl" + > "$template_dir/previewpage.tmpl" mkdir -p "$TEST_TMPDIR/dist" printf 'old index\n' > "$TEST_TMPDIR/dist/index.html" test::write_album_config \ @@ -3858,7 +3858,7 @@ test_generate_templates_cannot_read_renderer_internals() { cp -R "$TEST_REPO_ROOT/share/templates/default" "$template_dir" # shellcheck disable=SC2016 printf 'printf "context key: %%s\\n" "${context_key}"\n' \ - > "$template_dir/preview.tmpl" + > "$template_dir/previewpage.tmpl" mkdir -p "$TEST_TMPDIR/dist" printf 'old index\n' > "$TEST_TMPDIR/dist/index.html" test::write_album_config \ @@ -3897,7 +3897,7 @@ test_generate_templates_cannot_read_serialized_context_hook() { cp -R "$TEST_REPO_ROOT/share/templates/default" "$template_dir" # shellcheck disable=SC2016 printf 'printf "bash env: %%s\\n" "${BASH_ENV}"\n' \ - > "$template_dir/preview.tmpl" + > "$template_dir/previewpage.tmpl" mkdir -p "$TEST_TMPDIR/dist" printf 'old index\n' > "$TEST_TMPDIR/dist/index.html" test::write_album_config \ @@ -3932,6 +3932,7 @@ header:backhref background_image blurs_dir html_dir show_header_bar next:html_dir next prev:html_dir prev preview:animation_class backhref html_dir page_num photo preview_num thumbs_dir +previewpage:html_dir preview_thumbs redirect:html_dir redirect_page splash:backhref background_image blurs_dir enter_page html_dir photo photos_dir stats:backhref html_dir stats_body @@ -3951,6 +3952,7 @@ declare -a template_names=( next prev preview + previewpage redirect splash stats |
