From: Sergey Matveev Date: Sun, 13 Mar 2022 11:57:03 +0000 (+0300) Subject: Show notes mtime in title X-Git-Url: http://www.git.stargrave.org/?p=zk.zsh.git;a=commitdiff_plain;h=b4a557d2cd207cdbf95560eebe6e402df4364682 Show notes mtime in title --- diff --git a/zk.zsh b/zk.zsh index b8de2b3..253c502 100755 --- a/zk.zsh +++ b/zk.zsh @@ -19,8 +19,12 @@ EOF # Collect all pages setopt GLOB_STAR_SHORT +zmodload -F zsh/stat b:zstat typeset -A pages -for f (**(.)) pages[$f]=1 +for p (**(.)) { + zstat -A reply -F "%F %T" +mtime $p + pages[$p]=${reply[1]} +} # Determine the links between them typeset -A links @@ -78,12 +82,12 @@ genhtml() { data="${data//${p}/$p}" } print "<\!DOCTYPE html> -$page
+$page (${pages[$page]})
 $data
 

" } @@ -98,9 +102,11 @@ case $1 in mkdir -p $2/$subdir genhtml $p > $2/$p.html } - local all="" - for p (${(Oi)${(k)pages}}) all="$p\n$all" - genhtml ALL $all > $2/ALL.html + local all=() + for p (${(Oi)${(k)pages}}) all=("$p (${pages[$p]})" $all) + zmodload -F zsh/datetime b:strftime + pages[ALL]=$(strftime "%F %T") + genhtml ALL ${(j:\n:)all} > $2/ALL.html ;; (*) usage ;; esac