50 lines
2.0 KiB
HTML
50 lines
2.0 KiB
HTML
{{ $page := .page }}
|
|
<span aria-hidden="true">
|
|
{{ cond (and $page.IsNode (not .forceFile)) "drwxr-xr-x" "-rw-r--r--" }}
|
|
</span>
|
|
<span aria-hidden="true" style="text-align: right">
|
|
{{/* Nombre d'éléments dans le nœud, sinon 1 si c'est un fichier. */}}
|
|
{{ cond (and $page.IsNode (not .forceFile)) (len $page.Pages) "1" }}
|
|
</span>
|
|
<span aria-hidden="true" style="text-align: right">
|
|
{{/* La taille d'un répertoire est 4Kio. */}}
|
|
{{ $bytes := int (cond $page.IsNode (cond .forceFile (len $page.Content) 4096) $page.Len) }}
|
|
{{/* log(0) vaut -inf., donc on force base à 0 dans ce cas. */}}
|
|
{{ $base := cond (eq $bytes 0) 0 (int (div (math.Log $bytes) (math.Log 1024))) }}
|
|
{{ $divider := float (math.Pow 1024 $base) }}
|
|
{{ $value := div $bytes $divider }}
|
|
{{ $unit := index (slice "" "K" "M" "G") $base }}
|
|
{{ if eq $base 0 }}
|
|
{{ $bytes }}
|
|
{{ else if lt $value 10 }}
|
|
{{ lang.FormatNumber 1 $value }}{{ $unit }}
|
|
{{ else }}
|
|
{{ lang.FormatNumber 0 (math.Round $value) }}{{ $unit }}
|
|
{{ end }}
|
|
{{/* cond $page.IsNode (cond .forceFile (len $page.Content) "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">
|
|
{{/* 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 }}
|
|
<span>
|
|
<a class="{{ with $page.Params.class -}}{{ . }}{{ end }}"
|
|
{{ if and .currentPage (.currentPage.Eq $page) }}
|
|
aria-current="page"
|
|
{{ end }}
|
|
href="{{ $page.RelPermalink }}"
|
|
title="{{ $page.Title }}"
|
|
>
|
|
{{ or .linkTitle (print $page.File.BaseFileName "." $page.File.Ext) $page.LinkTitle }}{{ cond (and $page.IsNode (not .forceFile)) "/" "" }}
|
|
</a>
|
|
</span>
|
|
{{/* vim: set tw=80 ts=2 sw=2 sts=2 ft=gohtmltmpl: */}}
|