From 5555b8e996dc42d319c4ef7115307d10a25de7f3 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 14 Jun 2026 22:16:43 +0300 Subject: pm0 add stats page template and render function Render the aggregated STATS_* counters from the om0 module into a static stats.html. render_stats_page builds the variable-length body (camera leaderboard, temporal/exposure/dimension histograms, format and enum breakdowns) as HTML and hands it to the new stats.tmpl through a raw context field, wrapping it with the shared header/footer the way view/details pages do. Bars are pure CSS so the page stays JavaScript-free. - new template share/templates/default/stats.tmpl (page chrome + body) - render_stats_page [page_name] plus small section builders in src/lib/stats.source.sh; EXIF-derived labels are HTML-escaped - new TEMPLATE_RENDER_FIELD_SPECS field render_stats_body_html (context_raw) and 'stats' added to render_backhref_html's required list - camera leaderboard entries link to camera-.html (um0 owns those) - Stats nav link wired into the shared header bar - tests cover leaderboard links, counts/percentages, a histogram section, &/< escaping, and omission of empty categories Co-Authored-By: Claude Opus 4.8 --- share/templates/default/header.tmpl | 63 +++++++++++++++++++++++++++++++++++++ share/templates/default/stats.tmpl | 16 ++++++++++ 2 files changed, 79 insertions(+) create mode 100644 share/templates/default/stats.tmpl (limited to 'share/templates') diff --git a/share/templates/default/header.tmpl b/share/templates/default/header.tmpl index 953109a..e0acc6f 100644 --- a/share/templates/default/header.tmpl +++ b/share/templates/default/header.tmpl @@ -95,6 +95,67 @@ cat <codeberg.org/snonux/shuriken.sh - © by Paul Buetow + - + Stats END fi diff --git a/share/templates/default/stats.tmpl b/share/templates/default/stats.tmpl new file mode 100644 index 0000000..7a94b60 --- /dev/null +++ b/share/templates/default/stats.tmpl @@ -0,0 +1,16 @@ +# Stats page body. All of the variable-length, data-driven markup (camera +# leaderboard, histograms, format breakdown, enum tables) is pre-rendered by +# render_stats_page in src/lib/stats.source.sh and handed in through the raw +# context field render_stats_body_html, so this template only supplies the page +# chrome: the heading, the pre-built body, and a link back to the album. The +# surrounding // and footer come from the header/footer +# templates, which render_stats_page emits around this one (same as view/details). +cat < +

${render_title_html} — Stats

+ + ${render_stats_body_html} + +END -- cgit v1.2.3