hscc

Soure code of <https://hugo.soucy.cc>.
git clone git://soucy.cc/hscc.git
Log | Files | Refs

commit 0e6e8148d19090b0cae7a3c1ee191ca2ec920834
parent e90f0d60e21296ff2b20d329e786e1453d7e1278
Author: Hugo Soucy <hugo@soucy.cc>
Date:   Fri,  1 Oct 2021 18:58:51 -0400

Add archetypes

Diffstat:
Aarchetypes/archives.html | 34++++++++++++++++++++++++++++++++++
Marchetypes/bookmark.lua.mustache | 12++++++------
Marchetypes/tags.html | 10+++++++---
3 files changed, 47 insertions(+), 9 deletions(-)

diff --git a/archetypes/archives.html b/archetypes/archives.html @@ -0,0 +1,34 @@ +<h1><%= title -%></h1> +<ul class="archives-list"> + <% local inspect = require 'inspect' %> + <% local years_keys = {} %> + <% for k in pairs(archives) do table.insert(years_keys, k) end %> + <% table.sort(years_keys, function(a,b) return a > b end) %> + <!-- année --> + <% for _, year in ipairs(years_keys) do %> + <li class="archives-list__year"> + <h2 id="y<%= year -%>"> + <time><%= year -%></time> + </h2> + <% local months_keys = {} %> + <% for k in pairs(archives[year]) do table.insert(months_keys, k) end %> + <% table.sort(months_keys) %> + <!-- mois --> + <% for _, month in ipairs(months_keys) do %> + <dl class="archives-list__month"> + <dt id="y<%= year -%>m<%= month -%>"> + <time datetime="<%= year -%>-<%= month -%>"><%= months_names[month] -%></time> + </dt> + <!-- <ul class="archives-list__entries"> --> + <!-- entrées --> + <% for _, entry in ipairs(archives[year][month]) do %> + <dd> + <a href="<%= entry.rellink -%>"><%- entry.title -%></a> + </dd> + <% end %> + <!-- </ul> --> + </dl> + <% end %> + </li> + <% end %> +</ul> diff --git a/archetypes/bookmark.lua.mustache b/archetypes/bookmark.lua.mustache @@ -1,8 +1,8 @@ return { -title = "{{ title }}", -url = "{{{ url }}}", -date = "{{ date }}", -datetime = "{{ datetime }}", -posttype = "bookmark", -keywords = { {{#keywords}}"{{.}}",{{/keywords}} } + title = "{{ title }}", + url = "{{{ url }}}", + date = "{{ date }}", + datetime = "{{ datetime }}", + posttype = "bookmark", + keywords = { {{#keywords}}"{{.}}",{{/keywords}} } } diff --git a/archetypes/tags.html b/archetypes/tags.html @@ -1,9 +1,13 @@ <h1><%= title -%></h1> <dl class="tags"> - <% for tag, tag_table in pairs(tags) do %> - <dt id="<%= tag:gsub("%s+", "-") -%>"><%= tag -%></dt> - <% for _, tb in pairs(tag_table) do %> + <% local tags_keys = {} %> + <% for k in pairs(tags) do table.insert(tags_keys, k) end %> + <% table.sort(tags_keys) %> + + <% for _, tagkey in ipairs(tags_keys) do %> + <dt id="<%= tagkey:gsub("%s+", "-") -%>"><%= tagkey -%></dt> + <% for _, tb in ipairs(tags[tagkey]) do %> <dd> <a href="<%= tb.rellink -%>"> <%= tb.title -%>