From b4a557d2cd207cdbf95560eebe6e402df4364682 Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Sun, 13 Mar 2022 14:57:03 +0300 Subject: [PATCH] Show notes mtime in title --- zk.zsh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) 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 -- 2.44.0