. "$_EXEC/acl.sh"
. "$_EXEC/tools.sh"
-from='1'; to='$'; rev=''; items='$'; hl=0; link='true'
+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;;
--rev|--reverse) rev="-r"; shift 1;;
--nolink) link=""; shift 1;;
--hl|-hl) hl=$2; shift 2;;
- *) page="$1"; shift 1;;
+ --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
exit 1
fi
-page_glob "$page" \
+for page in "$@"; do
+ page_glob "$page" "$depth"
+done \
| sort $rev \
| sed "${items}q" \
| while read glob; do
page="$(page_abs "$glob")"
- acl_read "$page" || continue
mdfile="$(mdfile "$page")" || continue
+ acl_read "$page" || continue
+ has_tags "$page" $tags || continue
+ printf %s\\n "$INCLUDE_LIST" |grep -qxF "$page" && continue
+ export INCLUDE_LIST="${INCLUDE_LIST}${INCLUDE_LIST:+${BR}}$page"
hglob="$(HTML "$glob")"
refpfx="$(printf %s\\n "$hglob" |sed 's;[\;&\;];\\&;g')"
[ "$link" ] \
. "$_EXEC/acl.sh"
. "$_EXEC/tools.sh"
+tags='' dir='' depth='' glob_system_pages=false
+
+set -- "$@" --
while [ $# -gt 0 ]; do case $1 in
--system) glob_system_pages=true; shift 1;;
--depth) depth="$2" shift 2;;
+ \#*) tags="${tags}${tags:+ }${1###}"; shift 1;;
+ --) shift 1; break;;
*) if [ ! "$dir" ]; then
dir="$1"
+ set -- "$@" "$1"; shift 1;
elif [ ! "$depth" ]; then
- depth="$1"
- fi
- shift 1;;
+ depth="$1"; shift 1;
+ else
+ set -- "$@" "$1"; shift 1;
+ fi;;
esac; done
-[ "$dir" ] || dir=*
+[ "$*" ] || set -- "*"
[ "$depth" -ge 0 -o "$depth" -le 0 ] 2>&- || depth=0
printf '<ul class="macro pagelist">\n'
- page_glob "$dir" "$depth" \
- | while read -r glob; do
- printf %s\\n "$glob"
+ for dir in "$@"; do
+ page_glob "$dir" "$depth"
done \
+ | sort -u \
| while read -r page; do
pagedir="$(page_abs "$page")"
[ -f "$_DATA/pages/${pagedir}/#page.md" -o \
-f "$_EXEC/pages/${pagedir}/#page.md" ] \
&& acl_read "$pagedir" \
+ && has_tags "$pagedir" $tags \
&& printf '<li><a href="%s">%s</a></li>' "$(HTML "$page")" "$(HTML "$page")"
done
printf '</ul>\n'