page_children "$glob" "$((depth - 1))"
done \
| while read -r page; do
- case $page in
- /*) pagedir="$(PATH "$page")";;
- *) pagedir="$(PATH "$PATH_INFO/$page")";;
- esac
+ pagedir="$(page_abs "$page")"
[ -f "$_DATA/pages/${pagedir}/#page.md" -o \
-f "$_EXEC/pages/${pagedir}/#page.md" ] \
&& acl_read "$pagedir" \
| while read -r page; do
case $page in
\#*|*/\#*) continue;;
- /*) pagedir="$(PATH "$page")";;
- *) pagedir="$(PATH "$PATH_INFO/$page")";;
+ *) pagedir="$(page_abs "$page")";;
esac
[ -d "$_DATA/pages/$pagedir" -o -d "$_EXEC/pages/$pagedir" ] \
&& printf '%s\n' "$page"
| while read -r page; do
case $page in
\#*|*/\#*) continue;;
- /*) pagedir="$(PATH "$page")";;
- *) pagedir="$(PATH "$PATH_INFO/$page")";;
+ *) pagedir="$(page_abs "$page")";;
esac
if [ -d "$_DATA/pages/$pagedir" -o -d "$_EXEC/pages/$pagedir" ]; then
printf %s\\n "$page"
fi
done
}
+
+page_abs(){
+ case $1 in
+ /*) PATH "${1%/}/";;
+ *) PATH "${PATH_INFO%/*}/${1%/}/";;
+ esac
+}