Simplification et amélioration du menu ls.
This commit is contained in:
@@ -1,28 +1,24 @@
|
||||
{{ $page := .page }}
|
||||
<span aria-hidden="true">
|
||||
{{ if not $page.IsNode }}
|
||||
-rw-r--r--
|
||||
{{ else }}
|
||||
drwxr-xr-x
|
||||
{{ end }}
|
||||
</span>
|
||||
<span aria-hidden="true">{{ cond $page.IsNode "drwxr-xr-x" "-rw-r--r--" }}</span>
|
||||
<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 aria-hidden="true">{{ $page.Site.Params.owner }}</span>
|
||||
<span aria-hidden="true">{{ $page.Site.Params.group }}</span>
|
||||
<span aria-hidden="true" style="text-align: right">
|
||||
{{/* La taille d'un répertoire est 4Kio. */}}
|
||||
{{ if $page.IsNode }}4096{{ else }}{{ $page.Len }}{{ end }}
|
||||
{{ cond $page.IsNode "4096" $page.Len }}
|
||||
</span>
|
||||
{{ with (or $page.PublishDate $page.Lastmod) }}
|
||||
<span aria-hidden="true" style="text-align: right">{{ .Day }}</span>
|
||||
<span aria-hidden="true">{{ .Format "Jan" }}</span>
|
||||
<span aria-hidden="true" style="text-align: right">
|
||||
{{ if eq .Year time.Now.Year }}
|
||||
{{ . | time.Format ":time_short" }}
|
||||
{{ else }}
|
||||
{{/* Si l'élément est modifié depuis plus de 6 mois on affiche l'année, sinon l'heure */}}
|
||||
{{ if gt (time.Now.Sub .) (duration "hour" (mul 6 30 24)) }}
|
||||
{{ .Year }}
|
||||
{{ else }}
|
||||
{{ . | time.Format ":time_short" }}
|
||||
{{ end }}
|
||||
</span>
|
||||
{{ end }}
|
||||
|
||||
@@ -11,16 +11,16 @@
|
||||
{{/* La commande ls affiche total en Kio. */}}
|
||||
<p aria-hidden="true">total {{ math.Floor (div $sum 1024) }}</p>
|
||||
<ul class="lsresult">
|
||||
<li>{{ 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" . "linkTitle" ".") }}</li>
|
||||
<li class="directory">{{ partial "lsline.html" (dict "page" (or .Parent .) "linkTitle" "..") }}</li>
|
||||
{{ range .Sections.ByLastmod.Reverse }}
|
||||
<li>
|
||||
<li class="directory">
|
||||
{{ partial "lsline.html" (dict "page" . "linkTitle" .LinkTitle) }}
|
||||
</li>
|
||||
{{ end }}
|
||||
{{ range .Pages.ByPublishDate.Reverse }}
|
||||
{{ if .IsPage }}
|
||||
<li>
|
||||
<li class="file">
|
||||
{{ partial "lsline.html" (dict "page" . "linkTitle" .LinkTitle "currentPage" $page) }}
|
||||
</li>
|
||||
{{ end }}
|
||||
|
||||
Reference in New Issue
Block a user