]> Sergey Matveev's repositories - zk.git/commitdiff
Appropriate variable name
authorSergey Matveev <stargrave@stargrave.org>
Sun, 4 May 2025 10:40:40 +0000 (13:40 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Sun, 4 May 2025 11:48:55 +0000 (14:48 +0300)
zk.zsh

diff --git a/zk.zsh b/zk.zsh
index bce348c114a65938fc729551fab3675d7d4fdd54..75abc13d2fb3d3aa12038263818abda2cbbe694b 100755 (executable)
--- a/zk.zsh
+++ b/zk.zsh
@@ -23,7 +23,7 @@ EOF
 separator="------------------------ >8 ------------------------"
 setopt GLOB_STAR_SHORT
 zmodload -F zsh/stat b:zstat
-typeset -A pages
+typeset -A mtimes
 typeset -A sizes
 for p (**(.)) {
     [[ $p:t == "index" ]] && {
@@ -32,7 +32,7 @@ for p (**(.)) {
     }
     zstat -A mtime -F "%F %T" +mtime $p
     zstat -A size +size $p
-    pages[$p]=${mtime[1]}
+    mtimes[$p]=${mtime[1]}
     sizes[$p]=${size[1]}
 }
 typeset -A cats
@@ -44,7 +44,7 @@ typeset -A links
 typeset -A backs
 typeset -A cached
 typeset -aU ws
-for p (${(k)pages}) {
+for p (${(k)mtimes}) {
     [[ $ZK_CACHE ]] && {
         zstat -A inode +inode $p
         zstat -A ctime +ctime $p
@@ -66,7 +66,7 @@ for p (${(k)pages}) {
             ws=($ws $w)
             continue
         }
-        [[ ${pages[$w]} ]] || {
+        [[ ${mtimes[$w]} ]] || {
             [[ $ZK_SHOW_MISSING ]] && print "missing $w"
             continue
         }
@@ -138,7 +138,7 @@ $data</pre>"
         print "<hr/>Links:<ul>"
         for p ($_links) {
             getrel $page $p
-            print "<li><a href=\"${REPLY}.html\">$p</a> <sup>${pages[$p]}</sup></li>"
+            print "<li><a href=\"${REPLY}.html\">$p</a> <sup>${mtimes[$p]}</sup></li>"
         }
         print "</ul>"
     fi
@@ -147,7 +147,7 @@ $data</pre>"
         print "<hr/>Backlinks:<ul>"
         for p ($bs) {
             getrel $page $p
-            print "<li><a href=\"${REPLY}.html\">$p</a> <sup>${pages[$p]}</sup></li>"
+            print "<li><a href=\"${REPLY}.html\">$p</a> <sup>${mtimes[$p]}</sup></li>"
         }
         print "</ul>"
     fi
@@ -164,7 +164,7 @@ genIndex() {
     typeset -aU _cats=()
     local curdepth=${#${(s:/:)1}}
     (( curdepth = curdepth + 1 ))
-    for p (${(k)pages[(I)$1*]}) {
+    for p (${(k)mtimes[(I)$1*]}) {
         case ${#${(As:/:)p}} in
         ($curdepth) _links=($p $_links) ;;
         ( $(( $curdepth + 1 )) ) _cats=(${1}${${p#$1}%%/*} $_cats) ;;
@@ -179,7 +179,7 @@ genIndex() {
 </head><body><ul>"
     for p (${(oi)_links}) {
         getrel $page $p
-        print "<li><a href=\"${REPLY}.html\">$p</a> <sup>${pages[$p]}</sup> (${sizes[$p]} bytes)</li>"
+        print "<li><a href=\"${REPLY}.html\">$p</a> <sup>${mtimes[$p]}</sup> (${sizes[$p]} bytes)</li>"
     }
     print "</ul>"
     if [[ $_cats ]]; then
@@ -195,7 +195,7 @@ genIndex() {
         print "<hr/>Backlinks:<ul>"
         for p ($bs) {
             getrel $page $p
-            print "<li><a href=\"${REPLY}.html\">$p</a> <sup>${pages[$p]}</sup></li>"
+            print "<li><a href=\"${REPLY}.html\">$p</a> <sup>${mtimes[$p]}</sup></li>"
         }
         print "</ul>"
     fi
@@ -208,7 +208,7 @@ case $1 in
 (html) genHTML $2 ;;
 (html-index) genIndex $2 ;;
 (htmls)
-    for p (${(k)pages}) {
+    for p (${(k)mtimes}) {
         zf_mkdir -p $2/$p:h
         genHTML $p > $2/$p.html
         touch -r $p $2/$p.html