diff options
| author | Paul Buetow <paul@buetow.org> | 2026-06-17 23:21:03 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-06-17 23:21:03 +0300 |
| commit | 61890e0bd98262a55b3afff495ebfead33d76b96 (patch) | |
| tree | 9422f31856e205f6e9374a14c5205027f912d458 /tests/cli.sh | |
| parent | 7c94be57437ecdc9cadeb95bc4c26a25040163a9 (diff) | |
Add configurable SOURCE_URL footer link; release 0.9.00.9.0
The footer "Site generated ... with <link>" was hardcoded to the shuriken.sh
repository. Make it configurable via the SOURCE_URL config variable and the
--source-url CLI flag (defaulting to the shuriken.sh repo, so existing sites are
unchanged). The footer derives the displayed text from the URL by stripping its
scheme. Plumbed through apply_config_defaults, CLI override targets/spec,
--print-config, the verbose effective-config log, and the header template's
new render_source_url_html (config_html) render var. Documented in
shuriken.default.conf and README; added a generation test asserting a custom
SOURCE_URL replaces the default footer link, and updated the print-config and
header render-var-subset expectations.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'tests/cli.sh')
| -rwxr-xr-x | tests/cli.sh | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/cli.sh b/tests/cli.sh index 5ac6561..adbfcf5 100755 --- a/tests/cli.sh +++ b/tests/cli.sh @@ -523,6 +523,49 @@ test_generate_cli_overrides_config_values() { test::teardown } +# SOURCE_URL controls the footer "Site generated ... with <link>". The href uses +# the configured URL verbatim and the displayed text is that URL without its +# scheme, so a custom SOURCE_URL replaces the default shuriken.sh credit link. +test_generate_source_url_override_sets_footer_link() { + local config_file + local fake_bin + local page_html + + test::setup + fake_bin="$TEST_TMPDIR/bin" + config_file="$TEST_TMPDIR/shuriken.conf" + + test::install_fake_imagemagick "$fake_bin" + PATH="$fake_bin:$PATH" \ + test::generate_fixture_images "$TEST_TMPDIR/url-incoming" + + { + printf 'TITLE=%q\n' 'URL test' + printf 'THUMBHEIGHT=10\n' + printf 'HEIGHT=20\n' + printf 'MAXPREVIEWS=40\n' + printf 'INCOMING_DIR=%q/url-incoming\n' "$TEST_TMPDIR" + printf 'DIST_DIR=%q/url-dist\n' "$TEST_TMPDIR" + printf 'TEMPLATE_DIR=%q/share/templates/default\n' "$TEST_REPO_ROOT" + printf 'SOURCE_URL=https://codeberg.org/snonux/irregular.ninja\n' + printf 'TARBALL_INCLUDE=no\n' + } > "$config_file" + + ( + cd "$TEST_TMPDIR" + PATH="$fake_bin:$PATH" "$TEST_SHURIKEN" --generate --config "$config_file" + ) + + page_html=$(<"$TEST_TMPDIR/url-dist/page-1.html") + test::assert_contains \ + 'href="https://codeberg.org/snonux/irregular.ninja"' "$page_html" + test::assert_contains 'codeberg.org/snonux/irregular.ninja</a>' "$page_html" + # The default credit link must be gone once SOURCE_URL is overridden. + test::assert_not_contains 'codeberg.org/snonux/shuriken.sh' "$page_html" + + test::teardown +} + test_generate_height_bounds_photo_height_without_upscaling() { local config_file local -a create_command=() @@ -1364,6 +1407,7 @@ INCOMING_DIR=$TEST_TMPDIR/incoming DIST_DIR=$TEST_TMPDIR/dist TEMPLATE_DIR=$TEST_REPO_ROOT/share/templates/default FAVICON='' +SOURCE_URL=https://codeberg.org/snonux/shuriken.sh TITLE=A\\ simple\\ Shuriken HEIGHT=1200 THUMBHEIGHT=300 @@ -1412,6 +1456,7 @@ INCOMING_DIR=$TEST_TMPDIR/incoming DIST_DIR=$TEST_TMPDIR/dist TEMPLATE_DIR=$TEST_REPO_ROOT/share/templates/default FAVICON='' +SOURCE_URL=https://codeberg.org/snonux/shuriken.sh TITLE=Minimal\\ defaults HEIGHT='' THUMBHEIGHT=30 @@ -1553,6 +1598,7 @@ INCOMING_DIR=$TEST_TMPDIR/custom-incoming DIST_DIR=$TEST_TMPDIR/custom-dist TEMPLATE_DIR=$TEST_REPO_ROOT/share/templates/default FAVICON='' +SOURCE_URL=https://codeberg.org/snonux/shuriken.sh TITLE=Selected\\ config HEIGHT=120 THUMBHEIGHT=30 @@ -1596,6 +1642,7 @@ INCOMING_DIR=$TEST_TMPDIR/incoming DIST_DIR=$TEST_TMPDIR/dist TEMPLATE_DIR=$TEST_REPO_ROOT/share/templates/default FAVICON='' +SOURCE_URL=https://codeberg.org/snonux/shuriken.sh TITLE=Current\\ directory\\ config HEIGHT=120 THUMBHEIGHT=30 @@ -1664,6 +1711,7 @@ INCOMING_DIR=$TEST_TMPDIR/cli-incoming DIST_DIR=$dist_dir TEMPLATE_DIR=$TEST_TMPDIR/cli-template FAVICON='' +SOURCE_URL=https://codeberg.org/snonux/shuriken.sh TITLE=CLI\\ title HEIGHT=456 THUMBHEIGHT=45 @@ -4180,6 +4228,7 @@ BASH render_height_html \ render_html_dir_html \ render_show_header_bar \ + render_source_url_html \ render_stats_page_html \ render_thumbheight_html \ render_title_html | sort | paste -sd ' ' -) @@ -6311,6 +6360,9 @@ main() { '--generate CLI options override config' \ test_generate_cli_overrides_config_values test::run_case \ + '--generate SOURCE_URL override sets footer link' \ + test_generate_source_url_override_sets_footer_link + test::run_case \ '--generate HEIGHT bounds photo height without upscaling' \ test_generate_height_bounds_photo_height_without_upscaling test::run_case \ |
