X-Git-Url: https://git.plutz.net/?a=blobdiff_plain;f=macros%2Fpagelist;h=95395310d0856124eb003beedbe9d8709e33c21b;hb=b1fa8aa0381aadb3c471bce9b0f6b2748b58e72a;hp=2971515709fc03210abc3be1386797f6375adb45;hpb=f8bec3740e1d99684a5c33680e48d1f523c09983;p=shellwiki diff --git a/macros/pagelist b/macros/pagelist index 2971515..9539531 100755 --- a/macros/pagelist +++ b/macros/pagelist @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright 2022 - 2023 Paul Hänsch +# Copyright 2022 - 2024 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 @@ -17,14 +17,23 @@ . "$_EXEC/cgilite/cgilite.sh" . "$_EXEC/acl.sh" . "$_EXEC/tools.sh" +. "$_EXEC/db23.sh" -tags='' dir='' depth='' glob_system_pages=false +tags='' ntags='' dir='' depth='' glob_system_pages=false +label='' labeltype='' altlabel='' titles='' db3_data='' +DB3 new # Use DB3 for in-memory cache set -- "$@" -- while [ $# -gt 0 ]; do case $1 in --system) glob_system_pages=true; shift 1;; - --depth) depth="$2" shift 2;; + --depth) depth="$2"; shift 2;; + --titles) titles=true; shift 1;; \#*) tags="${tags}${tags:+ }${1###}"; shift 1;; + \!*) ntags="${ntags}${ntags:+ }${1##!}"; shift 1;; + --h1|--h2|--h3|--h4|--h5|--h6|--label) + labeltype="${1#--}" label="$2"; shift 2;; + --alt-label|--altlabel) + altlabel="$2"; shift 2;; --) shift 1; break;; *) if [ ! "$dir" ]; then dir="$1" @@ -39,17 +48,60 @@ esac; done [ "$*" ] || set -- "*" [ "$depth" -ge 0 -o "$depth" -le 0 ] 2>&- || depth=0 -printf '\n' +)" + +if [ "$pagelist" ]; then + [ "$label" ] \ + && printf '<%s class="macro pagelist label">%s' "$labeltype" "$(HTML "$label")" "$labeltype" + + printf '\n' + +elif [ "$altlabel" ]; then + printf '' "$(HTML "$altlabel")" +fi