summaryrefslogtreecommitdiff
path: root/src/lib/album-thumbnail-html.source.sh
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-06-24 21:46:31 +0300
committerPaul Buetow <paul@buetow.org>2026-06-24 21:46:31 +0300
commitf0154c2df57aae016f720122c8208fc4a1082495 (patch)
treed14856b669eba6714fe1f35a65b1223371c87bdd /src/lib/album-thumbnail-html.source.sh
parenta79e7d77cc6717f6c5bfaaefa5361f396c322de3 (diff)
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 <name>_to form (hot path, writes a named variable) plus a thin printf wrapper <name> 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 <noreply@anthropic.com>
Diffstat (limited to 'src/lib/album-thumbnail-html.source.sh')
-rw-r--r--src/lib/album-thumbnail-html.source.sh10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/album-thumbnail-html.source.sh b/src/lib/album-thumbnail-html.source.sh
index 110a0fa..8f34695 100644
--- a/src/lib/album-thumbnail-html.source.sh
+++ b/src/lib/album-thumbnail-html.source.sh
@@ -87,12 +87,12 @@ build_preview_thumbnail() {
local thumbs_dir_html
local anchor_class_html
- photo_html=$(_html_escape "$photo_file")
- anim_html=$(_html_escape "$animation_class")
- backhref_html=$(_html_escape "$backhref")
- thumbs_dir_html=$(_html_escape "$thumbs_dir")
+ photo_html=$(html_escape "$photo_file")
+ anim_html=$(html_escape "$animation_class")
+ backhref_html=$(html_escape "$backhref")
+ thumbs_dir_html=$(html_escape "$thumbs_dir")
if [ -n "$anchor_class" ]; then
- anchor_class_html=$(_html_escape "$anchor_class")
+ anchor_class_html=$(html_escape "$anchor_class")
printf '<a id=%s class=%s href=%s>\n' \
"'$photo_html'" "'$anchor_class_html'" \
"'${href_prefix}${preview_num}.html'"