]> git.plutz.net Git - shellwiki/blobdiff - tools.sh
bugfix: link path in revision list
[shellwiki] / tools.sh
index d147b73e6355b0d2ead11eb5097f4adc80724acc..4f7bc2525ff8e49cf5c5d5c72d252b8f49832be0 100755 (executable)
--- a/tools.sh
+++ b/tools.sh
@@ -3,6 +3,20 @@
 [ "$include_tools" ] && return 0
 include_tools="$0"
 
+# Copyright 2022 - 2023 Paul Hänsch
+# 
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+# 
+# THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+# SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+# IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
 md(){
   local parser
 
@@ -106,22 +120,17 @@ page_glob(){
   esac \
   | sort -u \
   | while read -r page; do
-    case $page in
-      \#*|*/\#*)  # Not a page directory (just a metadata dir)
-        continue
-        ;;
-      \[*\]/*|*/\[*\]/*)  # Omit "system" pages unless explicitly wanted
-        [ "$glob_system_pages" != true ] \
-        && continue \
-        || pagedir="$(page_abs "$page")"
-        ;;
-      \:*|*/\:*)  # Omit translation pages if translations are enabled
-        [ "$LANGUAGE_DEFAULT" ] \
-        && continue \
-        || pagedir="$(page_abs "$page")"
-        ;;
-      *) pagedir="$(page_abs "$page")";;
-    esac
+    # Not a page directory (just a metadata dir)
+    [ ! "${page%%#*}" -o ! "${page%%*/#*}" ] && continue
+
+    # Omit "system" pages unless explicitly wanted
+    [ ! "${page%%\[*\]/*}" -o ! "${page%%*/\[*\]/*}" ] && [ "$glob_system_pages" != true ] && continue
+
+    # Omit translation pages if translations are enabled
+    [ ! "${page%%:*}" -o ! "${page%%*/:*}" ] && [ "$LANGUAGE_DEFAULT" ] && continue
+
+    pagedir="$(page_abs "$page")"
+
     if [ -d "$_DATA/pages/$pagedir" -o -d "$_EXEC/pages/$pagedir" ]; then
       printf '%s\n' "$page"
       if ! [ "$depth" -eq 0 ]; then