Amélioration et simplification du menu ls.
This commit is contained in:
@@ -114,6 +114,17 @@ a:active {
|
||||
color: $lightgreen;
|
||||
}
|
||||
|
||||
/* Couleur différente pour les répertoire dans le menu ls */
|
||||
.lsresult li.directory {
|
||||
a:link {
|
||||
color: $blue;
|
||||
}
|
||||
|
||||
a:visited {
|
||||
color: $lightblue
|
||||
}
|
||||
}
|
||||
|
||||
// Colorisation du code en ligne.
|
||||
code:not([class]) {
|
||||
color: $green;
|
||||
|
||||
@@ -17,8 +17,6 @@ frontmatter:
|
||||
- :default
|
||||
|
||||
params:
|
||||
owner: alexis
|
||||
group: alexis
|
||||
|
||||
pagination:
|
||||
pagerSize: 15
|
||||
|
||||
@@ -4,13 +4,24 @@
|
||||
</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 $page.IsNode (len $page.Pages) "1" }}
|
||||
{{ cond (and $page.IsNode (not .forceFile)) (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. */}}
|
||||
{{ cond $page.IsNode "4096" $page.Len }}
|
||||
{{ $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>
|
||||
@@ -30,7 +41,9 @@
|
||||
aria-current="page"
|
||||
{{ end }}
|
||||
href="{{ $page.RelPermalink }}"
|
||||
title="{{ $page.Title }}">{{ or .linkTitle (print
|
||||
$page.File.BaseFileName "." $page.File.Ext) $page.LinkTitle }}</a>
|
||||
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: */}}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{{ $page := . }}
|
||||
<div class="cmdblock">
|
||||
<nav role="menu" aria-label="menu">
|
||||
<p aria-hidden="true" class="prompt">ls -alh</p>
|
||||
{{/* . et .. sont comptés dans le calcul. */}}
|
||||
<p aria-hidden="true" class="prompt">ls -pagot --group-directories-first</p>
|
||||
{{/* . et .. sont comptés dans le calcul de la taille. */}}
|
||||
{{ $sum := add 4096 4096 }}
|
||||
{{ range .Pages }}
|
||||
{{/* Un nœud c'est 4096 octets. */}}
|
||||
|
||||
Reference in New Issue
Block a user