X-Git-Url: http://git.plutz.net/?a=blobdiff_plain;f=macros%2Fchanges;h=8714976154c43748cae3d56b31ac85782950931f;hb=14a651b8b65411e8027156015722b8a836daa9d2;hp=be4dfec868ce86348c5b4e518d1b2f16d1c30dec;hpb=f8aef4eba181cf0ff368b96ffd26bdc30bd67852;p=shellwiki diff --git a/macros/changes b/macros/changes index be4dfec..8714976 100755 --- a/macros/changes +++ b/macros/changes @@ -4,9 +4,10 @@ . "$_EXEC/tools.sh" . "$_EXEC/acl.sh" -LANGUAGES='' +_(){ printf %s\\n "$*"; } +[ "${LANGUAGE}" -a -r "${_EXEC}/l10n/${LANGUAGE}.sh" ] && . "${_EXEC}/l10n/${LANGUAGE}.sh" -glob="/" depth=-1 +LANGUAGES='' glob="/" depth=-1 while [ $# -gt 0 ]; do case $1 in --system) glob_system_pages=true; shift 1;; :*) LANGUAGES="${LANGUAGES}${LANGUAGES:+ }${1#:}"; shift 1;; @@ -14,35 +15,48 @@ while [ $# -gt 0 ]; do case $1 in *) glob="$1"; shift 1;; esac; done -printf '\n' +page='' page_abs='' ostamp='' odate='' lstamp='' ldate='' row='' rowstate='' + +printf '
Page
\n' for l in $LANGUAGES; do printf '' "$l"; done printf '\n\n' page_glob "$glob" "$depth" |while read page; do - acl_read "$page" || continue + page_abs="$(page_abs "$page")" + acl_read "${page_abs}" || continue - printf '' read ostamp odate <<-EOF - $(git -C "$_DATA" log --pretty="format:%at %ar" -- "pages/${page}#page.md") + $([ "$REV_PAGES" = true ] \ + && git -C "$_DATA" log --pretty="format:%at %ai" -- "pages${page_abs}#page.md" \ + || stat -c "%Y %y" -- "$_DATA/pages${page_abs}#page.md" 2>&- \ + || printf "0 %s\n" "$(_ "(never edited)")" + ) EOF - printf '' "$(HTML "$page")" "$(HTML "$page")" "${odate}" + row="" + rowstate='' for l in $LANGUAGES; do if [ -f "${_DATA}/pages/${page}:${l}/#page.md" ]; then read lstamp ldate <<-EOF - $(git -C "$_DATA" log --pretty="format:%at %ar" -- "pages/${page}:${l}/#page.md") + $([ "$REV_PAGES" = true ] \ + && git -C "$_DATA" log --pretty="format:%at %ai" -- "pages$(page_abs "${page_abs}:${l}")/#page.md" \ + || stat -c "%Y %y" -- "$_DATA/pages$(page_abs "${page_abs}:${l}")/#page.md" + ) EOF - if [ $lstamp -lt $ostamp ]; then - printf '' "$(HTML "${page}:${l}")" "$ldate" + if [ $lstamp -lt $ostamp ] 2>&-; then + row="${row}" + [ "$rowstate" = "${rowstate%*outdated*}" ] && rowstate="${rowstate}${rowstate:+ }outdated" else - printf '' "$(HTML "${page}:${l}")" "$ldate" + row="${row}" + [ "$rowstate" = "${rowstate%*current*}" ] && rowstate="${rowstate}${rowstate:+ }current" fi else - printf '' "$(HTML "${page}:${l}")" + row="${row}" + [ "$rowstate" = "${rowstate%*missing*}" ] && rowstate="${rowstate}${rowstate:+ }missing" fi done - printf '\n' + printf '%s\n' "$rowstate" "$row" done printf '
Page%s
%s%s$(HTML "$page")${odate%%[+.]*}outdated%s$(_ outdated)${ldate%%[+.]*}current%s$(_ current)${ldate%%[+.]*}missing$(_ missing)
'