diff options
Diffstat (limited to 'layouts/_partials')
| -rw-r--r-- | layouts/_partials/asset-table.html | 33 | ||||
| -rw-r--r-- | layouts/_partials/asset_table.html | 31 |
2 files changed, 33 insertions, 31 deletions
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") }} +*/}} + +<table> + <thead> + <tr> + <th>Mod. date</th> + <th>File</th> + </tr> + </thead> + <tbody> + {{- range . }} + <tr> + <td> + {{- with resources.Get (printf "%s.moddate" .Name) -}} + {{- chomp .Content | time | dateFormat "2006-01-02" -}} + {{- end -}} + </td> + <td><a href="{{ .RelPermalink }}">{{ path.Base .Name }}</a></td> + </tr> + {{- end }} + </tbody> +</table> 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") }} -*/}} - -<table> - <thead> - <tr> - <th>Mod. date</th> - <th>File</th> - </tr> - </thead> - <tbody> - {{- range . }} - <tr> - <td> - {{- with os.Stat (path.Join "assets/" .Name) -}} - {{- .ModTime | time.Format "2006-01-02" -}} - {{- end -}} - </td> - <td><a href="{{ .RelPermalink }}">{{ path.Base .Name }}</a></td> - </tr> - {{- end }} - </tbody> -</table> |