#!/bin/sh
. "$_EXEC/cgilite/cgilite.sh"
. "$_EXEC/tools.sh"
. "$_EXEC/acl.sh"
page="$1"
page_abs="$(page_abs "$page")"
if ! acl_read "$page_abs"; then
return 0
elif [ ! "$(which git)" ]; then
printf '
GIT is not available to handle revisioning.
'
fi
printf '\n'
IFS=" "
{ git -C "$_DATA" log --date=format:"%a, %x %H:%M" \
--pretty=format:"%h %cd %s" \
-- "pages${page_abs}#page.md"
printf '\n'
} | while read -r hash date message; do
user="${message% @*}"; user="${user##*@ }"
printf '- %s%s%s
\n' \
"$(HTML "${page%/}/[revision]/$hash")" "$(HTML "$hash")" "$(HTML "$date")" "$(HTML "$user")"
done
printf '
\n'