. "$_EXEC/acl.sh"
. "$_EXEC/tools.sh"
-from='1'; to='$'; rev=''; items='$'
+from='1'; to='$'; rev=''; items='$'; link='true'
while [ $# -gt 0 ]; do case $1 in
--from) from="$2"; shift 2;;
--items) items="$2"; shift 2;;
items=*) items="${1#*=}"; shift 1;;
--rev|--reverse) rev="-r"; shift 1;;
+ --nolink) link=""; shift 1;;
*) page="$1"; shift 1;;
esac; done
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
mdfile="$(mdfile "$page")" || continue
hglob="$(HTML "$glob")"
refpfx="$(printf %s\\n "$hglob" |sed 's;[\;&\;];\\&;g')"
- printf '<div class="macro include">
- <a class="include link" href="%s">%s</a>
- <article class="include" id="include_%s">' \
- "${hglob}" "${hglob}" "${hglob}"
+ [ "$link" ] \
+ && printf '<div class="macro include">
+ <a class="include link" href="%s">%s</a>
+ <article class="include" id="include_%s">' \
+ "${hglob}" "${hglob}" "${hglob}" \
+ || printf '<div class="macro include">
+ <article class="include" id="include_%s">' \
+ "${hglob}"
( # PATH_INFO may be used by macros in the included page
export PATH_INFO="$page"
cd -- "${mdfile%/*}/"