From f0154c2df57aae016f720122c8208fc4a1082495 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Wed, 24 Jun 2026 21:46:31 +0300 Subject: Unify escape/date helper API; fix current_date_text caching Make the template.source.sh escape/date helper family follow one consistent shape: each escaper now has a nameref _to form (hot path, writes a named variable) plus a thin printf wrapper that delegates to it. The leading "_" now exclusively marks private helpers; the public escape API (called from sibling modules) is unprefixed. - current_date_text now delegates to current_date_text_to so both forms share the SHURIKEN_CURRENT_DATE_TEXT cache; the printf form no longer silently re-execs `date` on every direct call. Output unchanged. - Drop the misleading "_" prefix on the public escape API and update all callers: _html_escape->html_escape, _css_string_escape-> css_string_escape, _json_string->json_string, _json_bool->json_bool, _json_string_escape->json_string_escape. - Add the missing JSON nameref forms: json_string_escape_to, json_string_to, json_bool_to (printf wrappers delegate to them). - Add tests: JSON printf-vs-nameref parity and a current_date_text caching + nameref-parity check. No escaping/encoding or date output changes -- API-shape/perf only. Co-Authored-By: Claude Opus 4.8 --- src/lib/stats-filter-album.source.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/lib/stats-filter-album.source.sh') diff --git a/src/lib/stats-filter-album.source.sh b/src/lib/stats-filter-album.source.sh index c475006..aac6834 100644 --- a/src/lib/stats-filter-album.source.sh +++ b/src/lib/stats-filter-album.source.sh @@ -146,11 +146,11 @@ _stats_build_filterview_body() { local view_page local details_link='' - photo_html=$(_html_escape "$photo") + photo_html=$(html_escape "$photo") animation_class=$(random_animation_css_class fast "$photo") tooltip=$(photo_exif_tooltip_text "$photo" "$INCOMING_DIR/$photo") if [ -n "$tooltip" ]; then - tooltip_attr=" title=\"$(_html_escape "$tooltip")\"" + tooltip_attr=" title=\"$(html_escape "$tooltip")\"" fi view_page=$(album_view_page_for_photo "$photo") if [ -n "$view_page" ]; then -- cgit v1.2.3