]> Sergey Matveev's repositories - zk.zsh.git/commitdiff
Nothing prevents using "index" for convenience
authorSergey Matveev <stargrave@stargrave.org>
Tue, 15 Mar 2022 18:00:28 +0000 (21:00 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Tue, 15 Mar 2022 18:14:38 +0000 (21:14 +0300)
zk.zsh

diff --git a/zk.zsh b/zk.zsh
index 2a5d00ababb74f36f9d4ecbff4052c5ece39ef27..9b2d0a5426a106855aed0bf6eb8b75ca43292d99 100755 (executable)
--- a/zk.zsh
+++ b/zk.zsh
@@ -152,7 +152,7 @@ genIndex() {
     local curdepth=${#${(s:/:)1}}
     (( curdepth = curdepth + 1 ))
     for p (${(oi)${(k)pages[(I)$1*]}}) {
-        [[ ( $p =~ "/Index$" ) || ( $p = "Index" ) ]] && continue
+        [[ ( $p =~ "/index$" ) || ( $p = "index" ) ]] && continue
         case ${#${(As:/:)p}} in
         ($curdepth) _links=($p $_links) ;;
         ( $(( $curdepth + 1 )) ) cats=(${1}${${p#$1}%%/*} $cats) ;;
@@ -164,12 +164,12 @@ genIndex() {
     if [[ $cats ]]; then
         entries=($entries " " "Subdirectories:" " ")
         for p (${(oi)cats}) {
-            entries=($entries "[$p/Index]")
-            _links=($p/Index $_links)
+            entries=($entries "[$p/index]")
+            _links=($p/index $_links)
         }
     fi
-    links[${1}Index]=${(j: :)_links}
-    genHTML ${1}Index ${(F)entries}
+    links[${1}index]=${(j: :)_links}
+    genHTML ${1}index ${(F)entries}
 }
 
 case $1 in
@@ -183,11 +183,11 @@ case $1 in
         genHTML $p > $2/$p.html
         touch -r $p $2/$p.html
     }
-    for p ($cats) pages[${p}/Index]=$now
-    pages[Index]=$now
-    for p ($cats) genIndex $p/ > $2/$p/Index.html
-    genIndex "" > $2/Index.html
-    for p ("" $cats) touch -d ${now/ /T} $2/$p/Index.html
+    for p ($cats) pages[${p}/index]=$now
+    pages[index]=$now
+    for p ($cats) genIndex $p/ > $2/$p/index.html
+    genIndex "" > $2/index.html
+    for p ("" $cats) touch -d ${now/ /T} $2/$p/index.html
     ;;
 (*) usage ;;
 esac