+print_page() {
+ # print page URL and resolve page title (for use with --title flag)
+ # avoid calling this function via a subshell (i.e. $(print_page *))
+ # because it should be able to write its cache variable
+ local page="${1%/}/" title='' pfrag=''
+ pfrag="${page}"
+
+ # resolve name of each path element
+ while [ "${pfrag%/*}" -a "${pfrag%/*}" != "${pfrag}" ]; do
+ pfrag="${pfrag%/*}"
+ title="$(DB3 get "${pfrag}" || ! page_title "$(page_abs "${pfrag}")")/${title}" && break
+ done
+ # keep resolved names in cache
+ DB3 set "${page%/*}" "${title%/}"
+
+ [ "${page#/}" != "${page}" ] && title="/$title"
+ printf '%s %s\n' "$(URL "$page")" "$(HTML "${title}")"
+}
+
+pagelist="$(
+ for dir in "$@"; do
+ page_glob "$dir" "$depth"
+ done \
+ | sort -u \
+ | while read -r page; do