hscc

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

commit 24d953b15f9e1973c6461c6659a5a4b8f11fcd97
parent 4e1b7f82c18e575959abd303b0cddd3df6b6ef30
Author: Hugo Soucy <hugo@soucy.cc>
Date:   Mon, 18 Oct 2021 18:20:25 -0400

Change loops type

Diffstat:
Msrc/css/modules/hentry.css | 4----
Msrc/css/modules/hfeed.css | 9+++++++++
Mtemplates/archives.html | 1-
Mtemplates/default-index.html | 6+++---
Mtemplates/feed.xml.html | 14+++++++-------
Mtemplates/posttypes/article.html | 4++--
Mtemplates/posttypes/bookmark.html | 4++--
Mtemplates/posttypes/note-index.html | 6+++---
Mtemplates/posttypes/note.html | 4++--
Mtemplates/posttypes/reply.html | 4++--
Mtemplates/publications.html | 67+++++++++++++++++++++++++++++++++++++++++++------------------------
Mtemplates/sitemap.xml.html | 6+++---
12 files changed, 76 insertions(+), 53 deletions(-)

diff --git a/src/css/modules/hentry.css b/src/css/modules/hentry.css @@ -27,10 +27,6 @@ box-shadow: 0 0 0 0.75rem white; } -.hfeed .hentry:first-child { - margin-top: calc(var(--base-space) * 10); -} - .hfeed .hentry a:not(.u-url) { position: relative; z-index: 1; diff --git a/src/css/modules/hfeed.css b/src/css/modules/hfeed.css @@ -4,6 +4,15 @@ margin-top: calc(var(--base-space) * 6); } +.hfeed__infos { + align-items: center; + display: flex; + justify-content: space-between; + margin-top: calc(var(--base-space) * 10); + position: relative; + z-index: 1; +} + .hfeed__entries { list-style-type: none; margin: 0; diff --git a/templates/archives.html b/templates/archives.html @@ -3,7 +3,6 @@ <% if archives_children then %> <ul class="archives-list" data-js-archives="list"> - <% local years_keys = {} %> <% for k in pairs(archives_children) do table.insert(years_keys, k) end %> <% table.sort(years_keys, function(a,b) return a > b end) %> diff --git a/templates/default-index.html b/templates/default-index.html @@ -4,10 +4,10 @@ </div> <% if children then %> <ol> - <% for _, child in pairs(children) do %> + <% for i = 1, #children do %> <li> - <a href="<%= child.rellink -%>"><%= child.title -%></a> &mdash; - <time class="dt-published" datetime="<%= child.date -%>T<%= child.datetime -%>"><%= child.date -%></time> + <a href="<%= children[i].rellink -%>"><%= children[i].title -%></a> &mdash; + <time class="dt-published" datetime="<%= children[i].date -%>T<%= children[i].datetime -%>"><%= children[i].date -%></time> </li> <% end %> </ol> diff --git a/templates/feed.xml.html b/templates/feed.xml.html @@ -16,15 +16,15 @@ </author> <% if children then %> - <% for _, child in ipairs(children) do %> + <% for i = 1, #children do %> <entry> - <title><%- child.title -%></title> - <id><%- child.id -%></id> - <link href="<%= child.permalink -%>" hreflang="<%= child.language -%>" rel="alternate" type="text/html" /> - <published><%= child.date -%>T<%= child.datetime -%>Z</published> - <updated><%- os.date('%Y-%m-%dT%H:%M:%S', child.time_modification) -%>Z</updated> + <title><%- children[i].title -%></title> + <id><%- children[i].id -%></id> + <link href="<%= children[i].permalink -%>" hreflang="<%= children[i].language -%>" rel="alternate" type="text/html" /> + <published><%= children[i].date -%>T<%= children[i].datetime -%>Z</published> + <updated><%- os.date('%Y-%m-%dT%H:%M:%S', children[i].time_modification) -%>Z</updated> <content type="html"> - <%= child.content -%> + <%= children[i].content -%> </content> </entry> <% end %> diff --git a/templates/posttypes/article.html b/templates/posttypes/article.html @@ -13,9 +13,9 @@ <% if keywords then %> <ul aria-label="Liste de mots clés" class="hentry__categories"> - <% for i, keyword in ipairs(keywords) do %> + <% for i = 1, #keywords do %> <li> - <a class="p-category" href="/mots-cles.html#<%- keyword:gsub("%s+", "-") -%>" rel="tag"><%- keyword -%></a> + <a class="p-category" href="/mots-cles.html#<%- keywords[i]:gsub("%s+", "-") -%>" rel="tag"><%- keywords[i] -%></a> </li> <% end %> </ul> diff --git a/templates/posttypes/bookmark.html b/templates/posttypes/bookmark.html @@ -19,9 +19,9 @@ <% if keywords then %> <ul class="hentry__categories"> - <% for i, keyword in ipairs(keywords) do %> + <% for i = 1, #keywords do %> <li> - <a class="p-category" href="/mots-cles.html#<%- keyword:gsub("%s+", "-") -%>" rel="tag"><%- keyword -%></a> + <a class="p-category" href="/mots-cles.html#<%- keywords[i]:gsub("%s+", "-") -%>" rel="tag"><%- keywords[i] -%></a> </li> <% end %> </ul> diff --git a/templates/posttypes/note-index.html b/templates/posttypes/note-index.html @@ -4,10 +4,10 @@ </div> <% if children then %> <ol> - <% for _, child in ipairs(children) do %> + <% for i = 1, #children do %> <li> - <a href="<%= child.rellink -%>"><%= child.title -%></a> &mdash; - <time class="dt-published" datetime="<%= child.date -%>T<%= child.datetime -%>"><%= child.date -%></time> + <a href="<%= children[i].rellink -%>"><%= children[i].title -%></a> &mdash; + <time class="dt-published" datetime="<%= children[i].date -%>T<%= children[i].datetime -%>"><%= children[i].date -%></time> </li> <% end %> </ol> diff --git a/templates/posttypes/note.html b/templates/posttypes/note.html @@ -28,9 +28,9 @@ <% if keywords then %> <ul class="hentry__categories"> - <% for i, keyword in ipairs(keywords) do %> + <% for i = 1, #keywords do %> <li> - <a class="p-category" href="/mots-cles.html#<%- keyword:gsub("%s+", "-") -%>" rel="tag"><%- keyword -%></a> + <a class="p-category" href="/mots-cles.html#<%- keywords[i]:gsub("%s+", "-") -%>" rel="tag"><%- keywords[i] -%></a> </li> <% end %> </ul> diff --git a/templates/posttypes/reply.html b/templates/posttypes/reply.html @@ -10,9 +10,9 @@ <% if keywords then %> <ul class="hentry__categories"> - <% for i, keyword in ipairs(keywords) do %> + <% for i = 1, #keywords do %> <li> - <a class="p-category" href="/mots-cles.html#<%- keyword:gsub("%s+", "-") -%>" rel="tag"><%- keyword -%></a> + <a class="p-category" href="/mots-cles.html#<%- keywords[i]:gsub("%s+", "-") -%>" rel="tag"><%- keywords[i] -%></a> </li> <% end %> </ul> diff --git a/templates/publications.html b/templates/publications.html @@ -1,11 +1,30 @@ <article class="h-feed hfeed"> - <%- content %> - <small><%= #children -%> entrée(s)</small> + <header class="hfeed__header"> + <%- content %> + </header> + + <div class="hfeed__infos"> + <small><%= #children -%> entrée(s)</small> + <nav> + <% local year = tonumber(date:sub(1,4)) %> + <% local year_next = (year + 1) %> + <% local year_prev = (year - 1) %> + + <% if year > 2020 then %> + <a href="/<%= year_prev -%>" rel="prev"><small><%= year_prev -%></small></a> + <% end %> + + <% if year < tonumber(os.date('%Y')) then %> + <a href="/<%= year_next -%>" rel="next"><small><%= year_next -%></small></a> + <% end %> + </nav> + </div> + <% if children then %> <ol class="hfeed__entries"> - <% for _, child in ipairs(children) do %> - <li class="h-entry hentry<% if child.posttype == 'note' then %> as-note<% end %>"> - <% if child.posttype == 'bookmark' then %> + <% for i = 1, #children do %> + <li class="h-entry hentry<% if children[i].posttype == 'note' then %> as-note<% end %>"> + <% if children[i].posttype == 'bookmark' then %> <small class="hentry__posttype"> <svg class="ico" height="24" width="24" role="image"><use href="#ico_bookmark"></use></svg> Marque-page @@ -13,59 +32,59 @@ <h2 class="p-name"> <a class="u-bookmark-of h-cite" - href="<%= child.url %>" + href="<%= children[i].url %>" rel="external"> - <%- child.title -%> + <%- children[i].title -%> </a> </h2> - <% elseif child.posttype == 'note' then %> + <% elseif children[i].posttype == 'note' then %> <small class="hentry__posttype"> <svg class="ico" height="24" width="24" role="image"><use href="#ico_note"></use></svg> Note </small> <h2 class="visuallyhidden"> - <%= child.title -%> + <%= children[i].title -%> </h2> - <% elseif child.posttype == 'reply' then %> + <% elseif children[i].posttype == 'reply' then %> <small class="hentry__posttype"> <svg class="ico" height="24" width="24" role="image"><use href="#ico_corner_down_left"></use></svg> - <span>En réponse à </span><cite><a href="<%- child.url -%>" class="u-in-reply-to" rel="external"><%- child.url -%></a></cite>. + <span>En réponse à </span><cite><a href="<%- children[i].url -%>" class="u-in-reply-to" rel="external"><%- children[i].url -%></a></cite>. </small> - <% elseif child.posttype == 'article' then %> + <% elseif children[i].posttype == 'article' then %> <small class="hentry__posttype"> <svg class="ico" height="24" width="24" role="image"><use href="#ico_article"></use></svg> Texte </small> - <h2 class="p-name"><%= child.title -%></h2> + <h2 class="p-name"><%= children[i].title -%></h2> - <% if child.summary then %> - <p class="p-content"><%- child.summary -%></p> + <% if children[i].summary then %> + <p class="p-content"><%- children[i].summary -%></p> <% end %> <% else %> <h2 class="visuallyhidden"> - <%= child.title -%> + <%= children[i].title -%> </h2> <% end %> - <% if not child.summary then %> - <div class="e-content<% if child.posttype == 'note' then %> p-name<% end %>"><%- child.content -%></div> + <% if not children[i].summary then %> + <div class="e-content<% if children[i].posttype == 'note' then %> p-name<% end %>"><%- children[i].content -%></div> <% end %> <footer class="hentry__footer"> - <% if child.keywords and child.posttype == 'bookmark' then %> + <% if children[i].keywords and children[i].posttype == 'bookmark' then %> <ul class="hentry__categories"> - <% for i, keyword in ipairs(child.keywords) do %> + <% for j = 1, #children[i].keywords do %> <li> - <em class="p-category"><%- keyword -%></em> + <em class="p-category"><%- children[i].keywords[j] -%></em> </li> <% end %> </ul> <% end %> <div> - Publié le <a class="u-url" href="<%= child.rellink -%>"> - <time class="dt-published" datetime="<%= child.date -%>T<%= child.datetime -%>"><%= child.date -%></time></a>. - <span class="visuallyhidden">Par <em class="p-author author h-card"><%= child.author.name -%></em>.</span> + Publié le <a class="u-url" href="<%= children[i].rellink -%>"> + <time class="dt-published" datetime="<%= children[i].date -%>T<%= children[i].datetime -%>"><%= children[i].date -%></time></a>. + <span class="visuallyhidden">Par <em class="p-author author h-card"><%= children[i].author.name -%></em>.</span> </div> </footer> </li> diff --git a/templates/sitemap.xml.html b/templates/sitemap.xml.html @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="utf-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <% if sitemap then %> - <% for _, entry in pairs(sitemap) do %> + <% for i = 1, #sitemap do %> <url> - <loc><%= entry.permalink -%></loc> - <lastmod><%- os.date('%Y-%m-%dT%H:%M:%S', entry.time_modification) -%>Z</lastmod> + <loc><%= sitemap[i].permalink -%></loc> + <lastmod><%- os.date('%Y-%m-%dT%H:%M:%S', sitemap[i].time_modification) -%>Z</lastmod> </url> <% end %> <% end %>