case "${PATH_INFO}" in
*/\[revision\]/)
- REDIRECT "${_BASE}/${PATH_INFO%/}"
+ REDIRECT "${_BASE}${PATH_INFO%/}"
;;
*/\[revision\])
if ! acl_read "${PATH_INFO%\[revision\]}"; then
fi
return 0
;;
- */[revision]/*):;;
+ */\[revision\]/\[*\]|*/\[revision\]/*/*)
+ REDIRECT "${_BASE}${PATH_INFO%%\[revision\]/*}${PATH_INFO##*/\[revision\]/}"
+ ;;
+ */\[revision\]/*)
+ page="${PATH_INFO%\[revision\]/*}"
+ rev="${PATH_INFO##*/}"
+ if ! acl_read "${page}"; then
+ theme_error 403
+ else
+ ( export PATH_INFO="${page}"
+ cd "${_DATA}/pages${page}"
+ git show "${rev}:./#page.md" \
+ | { printf '<article class="revision">'; md; printf '</article>'; } \
+ | theme_page - "${page##*/}"
+ )
+ fi
+ return 0
+ ;;
esac
return 1
} | while read -r hash date message; do
user="${message% @*}"; user="${user##*@ }"
printf '<li><span class="hash"><a href="%s">%s</a></span><span class="date">%s</span><span class="user">%s</span></li>\n' \
- "$(HTML "${page%/}/[revisions]/$hash")" "$(HTML "$hash")" "$(HTML "$date")" "$(HTML "$user")"
+ "$(HTML "${page%/}/[revision]/$hash")" "$(HTML "$hash")" "$(HTML "$date")" "$(HTML "$user")"
done
printf '</ul>\n'