X-Git-Url: https://git.plutz.net/?a=blobdiff_plain;ds=sidebyside;f=macros%2Finclude;h=fbc2ffffbde5b013584c5242bfc27cf244adf452;hb=c482ab648dce89fd42b6110728e8b05df4073732;hp=9f3339df5201e617ebfb443d7dc9f3575771eead;hpb=fc220928ead75918a98d045ba606e871e27eaa4c;p=shellwiki diff --git a/macros/include b/macros/include index 9f3339d..fbc2fff 100755 --- a/macros/include +++ b/macros/include @@ -1,15 +1,26 @@ #!/bin/sh +# 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. + . "$_EXEC/cgilite/cgilite.sh" . "$_EXEC/acl.sh" . "$_EXEC/tools.sh" -from=1 -to=\$ -rev='' -items=\$ -path_info="$PATH_INFO" +from='1'; to='$'; rev=''; items='$'; hl=0; link='true'; depth=0; tags=''; page=''; +set -- "$@" -- while [ $# -gt 0 ]; do case $1 in --from) from="$2"; shift 2;; from=*) from="${1#*=}"; shift 1;; @@ -18,14 +29,19 @@ while [ $# -gt 0 ]; do case $1 in --items) items="$2"; shift 2;; items=*) items="${1#*=}"; shift 1;; --rev|--reverse) rev="-r"; shift 1;; - *) page="$1"; shift 1;; + --nolink) link=""; shift 1;; + --hl|-hl) hl=$2; shift 2;; + --depth) depth=$2; shift 2;; + \#*) tags="${tags}${tags:+ }${1}"; shift 1;; + --) shift 1; break;; + *) set -- "$@" "$1"; shift 1;; esac; done if ! printf %s\\n "$from" |grep -qEx '[0-9]+|/([^/\\]|\\/|\\.)*/'; then debug 'Include macro invalid argument: "from"' exit 1 fi -if ! printf %s\\n "$to" |grep -qEx '[0-9]+|/([^/\\]|\\/|\\.)*/'; then +if ! printf %s\\n "$to" |grep -qEx '\$|[0-9]+|/([^/\\]|\\/|\\.)*/'; then debug 'Include macro Invalid argument: "to"' exit 1 fi @@ -34,27 +50,31 @@ if ! printf %s\\n "$items" |grep -qEx '\$|[0-9]+'; then exit 1 fi -printf '