From ca484eaeda69237554fe0758ff647478362fab07 Mon Sep 17 00:00:00 2001 From: Sam Anthony Date: Sat, 10 Jan 2026 20:04:43 -0500 Subject: record file modification times --- assets/auto/brake.ods.moddate | 1 + assets/auto/damper.ods.moddate | 1 + assets/auto/spring_bar.ods.moddate | 1 + assets/auto/suspension.ods.moddate | 1 + assets/auto/tire.ods.moddate | 1 + layouts/_partials/asset-table.html | 33 +++++++++++++++++++++++++++++++++ layouts/_partials/asset_table.html | 31 ------------------------------- layouts/auto/page.html | 2 +- 8 files changed, 39 insertions(+), 32 deletions(-) create mode 100644 assets/auto/brake.ods.moddate create mode 100644 assets/auto/damper.ods.moddate create mode 100644 assets/auto/spring_bar.ods.moddate create mode 100644 assets/auto/suspension.ods.moddate create mode 100644 assets/auto/tire.ods.moddate create mode 100644 layouts/_partials/asset-table.html delete mode 100644 layouts/_partials/asset_table.html diff --git a/assets/auto/brake.ods.moddate b/assets/auto/brake.ods.moddate new file mode 100644 index 0000000..b2111e6 --- /dev/null +++ b/assets/auto/brake.ods.moddate @@ -0,0 +1 @@ +2025-01-02 diff --git a/assets/auto/damper.ods.moddate b/assets/auto/damper.ods.moddate new file mode 100644 index 0000000..b2111e6 --- /dev/null +++ b/assets/auto/damper.ods.moddate @@ -0,0 +1 @@ +2025-01-02 diff --git a/assets/auto/spring_bar.ods.moddate b/assets/auto/spring_bar.ods.moddate new file mode 100644 index 0000000..b2111e6 --- /dev/null +++ b/assets/auto/spring_bar.ods.moddate @@ -0,0 +1 @@ +2025-01-02 diff --git a/assets/auto/suspension.ods.moddate b/assets/auto/suspension.ods.moddate new file mode 100644 index 0000000..b2111e6 --- /dev/null +++ b/assets/auto/suspension.ods.moddate @@ -0,0 +1 @@ +2025-01-02 diff --git a/assets/auto/tire.ods.moddate b/assets/auto/tire.ods.moddate new file mode 100644 index 0000000..b2111e6 --- /dev/null +++ b/assets/auto/tire.ods.moddate @@ -0,0 +1 @@ +2025-01-02 diff --git a/layouts/_partials/asset-table.html b/layouts/_partials/asset-table.html new file mode 100644 index 0000000..d5e893c --- /dev/null +++ b/layouts/_partials/asset-table.html @@ -0,0 +1,33 @@ +{{- /* +For a given collection of global resources, render a table with +the modification date of each resource and a link to the resource. +The resources must be from the assets/ directory and each must +have a corresponding .moddate file, e.g., assets/foo/bar.txt and +assets/foo/bar.txt.moddate containing "1999-01-02". This is to preserve +the modification times of files when the repository is cloned. + +@context {.} resource.Resources + +@example: {{ partial "asset-table.html" (resources.Match "spreadsheets/*.ods") }} +*/}} + + + + + + + + + + {{- range . }} + + + + + {{- end }} + +
Mod. dateFile
+ {{- with resources.Get (printf "%s.moddate" .Name) -}} + {{- chomp .Content | time | dateFormat "2006-01-02" -}} + {{- end -}} + {{ path.Base .Name }}
diff --git a/layouts/_partials/asset_table.html b/layouts/_partials/asset_table.html deleted file mode 100644 index 461f3ce..0000000 --- a/layouts/_partials/asset_table.html +++ /dev/null @@ -1,31 +0,0 @@ -{{- /* -For a given collection of global resources, render a table with -the modification date of each resource and a link to the resource. -The resources must be from the assets/ directory in order to get their -modification times. - -@context {,} resource.Resources - -@example: {{ partial "asset_table.html" (resources.Match "spreadsheets/*.ods") }} -*/}} - - - - - - - - - - {{- range . }} - - - - - {{- end }} - -
Mod. dateFile
- {{- with os.Stat (path.Join "assets/" .Name) -}} - {{- .ModTime | time.Format "2006-01-02" -}} - {{- end -}} - {{ path.Base .Name }}
diff --git a/layouts/auto/page.html b/layouts/auto/page.html index eaa06d7..f51c292 100644 --- a/layouts/auto/page.html +++ b/layouts/auto/page.html @@ -2,5 +2,5 @@

{{ .Title }}

{{ .Content }}

Spreadsheets

- {{- partial "asset_table.html" (resources.Match "auto/*.ods") }} + {{- partial "asset-table.html" (resources.Match "auto/*.ods") }} {{ end }} -- cgit v1.2.3