- case $glob in
- /*) export PATH_INFO="$(PATH "$glob")";;
- *) export PATH_INFO="$(PATH "$path_info/$glob")";;
- esac
- acl_read || continue
- if [ -f "$_DATA/pages/$PATH_INFO/#page.md" ]; then
- mdfile="$_DATA/pages/$PATH_INFO/#page.md"
- elif [ -f "$_EXEC/pages/$PATH_INFO/#page.md" ]; then
- mdfile="$_EXEC/pages/$PATH_INFO/#page.md"
- else
- continue
- fi
- printf '<div class="macro include" page="%s">' "$(HTML "$glob")"
- ( cd -- "${mdfile%/*}"
+ page="$(page_abs "$glob")"
+ acl_read "$page" || continue
+ mdfile="$(mdfile "$page")" || continue
+ hglob="$(HTML "$glob")"
+ refpfx="$(printf %s\\n "$hglob" |sed 's;[\;&\;];\\&;g')"
+ [ "$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%/*}/"