Simplification et amélioration du menu ls.

This commit is contained in:
2026-03-20 01:52:31 +01:00
parent 863df2de23
commit 39cf5f4579
2 changed files with 12 additions and 16 deletions
+8 -12
View File
@@ -1,28 +1,24 @@
{{ $page := .page }} {{ $page := .page }}
<span aria-hidden="true"> <span aria-hidden="true">{{ cond $page.IsNode "drwxr-xr-x" "-rw-r--r--" }}</span>
{{ if not $page.IsNode }}
-rw-r--r--
{{ else }}
drwxr-xr-x
{{ end }}
</span>
<span aria-hidden="true" style="text-align: right"> <span aria-hidden="true" style="text-align: right">
{{ if $page.IsNode }}{{ len $page.Pages }}{{ else }}1{{ end }} {{/* Nombre d'éléments dans le nœud, sinon 1 si c'est un fichier. */}}
{{ cond $page.IsNode (len $page.Pages) "1" }}
</span> </span>
<span aria-hidden="true">{{ $page.Site.Params.owner }}</span> <span aria-hidden="true">{{ $page.Site.Params.owner }}</span>
<span aria-hidden="true">{{ $page.Site.Params.group }}</span> <span aria-hidden="true">{{ $page.Site.Params.group }}</span>
<span aria-hidden="true" style="text-align: right"> <span aria-hidden="true" style="text-align: right">
{{/* La taille d'un répertoire est 4Kio. */}} {{/* La taille d'un répertoire est 4Kio. */}}
{{ if $page.IsNode }}4096{{ else }}{{ $page.Len }}{{ end }} {{ cond $page.IsNode "4096" $page.Len }}
</span> </span>
{{ with (or $page.PublishDate $page.Lastmod) }} {{ with (or $page.PublishDate $page.Lastmod) }}
<span aria-hidden="true" style="text-align: right">{{ .Day }}</span> <span aria-hidden="true" style="text-align: right">{{ .Day }}</span>
<span aria-hidden="true">{{ .Format "Jan" }}</span> <span aria-hidden="true">{{ .Format "Jan" }}</span>
<span aria-hidden="true" style="text-align: right"> <span aria-hidden="true" style="text-align: right">
{{ if eq .Year time.Now.Year }} {{/* Si l'élément est modifié depuis plus de 6 mois on affiche l'année, sinon l'heure */}}
{{ . | time.Format ":time_short" }} {{ if gt (time.Now.Sub .) (duration "hour" (mul 6 30 24)) }}
{{ else }}
{{ .Year }} {{ .Year }}
{{ else }}
{{ . | time.Format ":time_short" }}
{{ end }} {{ end }}
</span> </span>
{{ end }} {{ end }}
+4 -4
View File
@@ -11,16 +11,16 @@
{{/* La commande ls affiche total en Kio. */}} {{/* La commande ls affiche total en Kio. */}}
<p aria-hidden="true">total {{ math.Floor (div $sum 1024) }}</p> <p aria-hidden="true">total {{ math.Floor (div $sum 1024) }}</p>
<ul class="lsresult"> <ul class="lsresult">
<li>{{ partial "lsline.html" (dict "page" . "linkTitle" ".") }}</li> <li class="directory">{{ partial "lsline.html" (dict "page" . "linkTitle" ".") }}</li>
<li>{{ partial "lsline.html" (dict "page" (or .Parent .) "linkTitle" "..") }}</li> <li class="directory">{{ partial "lsline.html" (dict "page" (or .Parent .) "linkTitle" "..") }}</li>
{{ range .Sections.ByLastmod.Reverse }} {{ range .Sections.ByLastmod.Reverse }}
<li> <li class="directory">
{{ partial "lsline.html" (dict "page" . "linkTitle" .LinkTitle) }} {{ partial "lsline.html" (dict "page" . "linkTitle" .LinkTitle) }}
</li> </li>
{{ end }} {{ end }}
{{ range .Pages.ByPublishDate.Reverse }} {{ range .Pages.ByPublishDate.Reverse }}
{{ if .IsPage }} {{ if .IsPage }}
<li> <li class="file">
{{ partial "lsline.html" (dict "page" . "linkTitle" .LinkTitle "currentPage" $page) }} {{ partial "lsline.html" (dict "page" . "linkTitle" .LinkTitle "currentPage" $page) }}
</li> </li>
{{ end }} {{ end }}