#!/bin/zsh
list_comments() {
base="$1"
for each in $(ls -r Wiki/${base}.comment.<0000000001-9999999999>_<000-999>); do
author=$(grep -m1 '^author=' "$each" |cut -d= -f2-)
echo "
'
done
}
add_comment(){
info="$1"
cat <<-WikiEND
WikiEND
}
wikitext="$(_wiki Wiki/"${info}${rev}")"
wikitoc="$(echo -E "$wikitext" \
| sed -rn '/.+<\/h[0-9]>/s;^.*(.+).*$;\3
;p'
)"
cat <
Revisions:
$(rno=1; for each in Wiki/$info.<0000000000-9999999999>; do
revi=$(cut -d. -f2 <<<"$each")
echo "$rno"
rno=$(($rno+1))
done) Latest
$($LOGIN && if [ -z "$lock" ]; then
[ -z "$rev" ] && echo "edit this page"
[ -n "$rev" ] && echo "Click edit to derive a new page revision from this one."
else
echo "This page is currently being edited by $lockedit anyway"
fi
$LOGIN && echo '
')
Table of Content
${wikitoc}
$($LOGIN && add_comment $info)
$(list_comments $info)
WikiEND
$author wrote: