X-Git-Url: http://git.plutz.net/?a=blobdiff_plain;f=macros%2Fchanges;h=8714976154c43748cae3d56b31ac85782950931f;hb=65676ea8331f60d882e3baec99c101382e9fad57;hp=c1e6946e4e4edd128fff206519800f4e14558668;hpb=9c54db6ec648c690cc3111faa19c3312d51d041e;p=shellwiki diff --git a/macros/changes b/macros/changes index c1e6946..8714976 100755 --- a/macros/changes +++ b/macros/changes @@ -4,6 +4,9 @@ . "$_EXEC/tools.sh" . "$_EXEC/acl.sh" +_(){ printf %s\\n "$*"; } +[ "${LANGUAGE}" -a -r "${_EXEC}/l10n/${LANGUAGE}.sh" ] && . "${_EXEC}/l10n/${LANGUAGE}.sh" + LANGUAGES='' glob="/" depth=-1 while [ $# -gt 0 ]; do case $1 in --system) glob_system_pages=true; shift 1;; @@ -23,25 +26,32 @@ page_glob "$glob" "$depth" |while read page; do acl_read "${page_abs}" || continue read ostamp odate <<-EOF - $(git -C "$_DATA" log --pretty="format:%at %ai" -- "pages${page_abs}#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 - row="$(HTML "$page")${odate%% +*}" + row="$(HTML "$page")${odate%%[+.]*}" 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 %ai" -- "pages$(page_abs "${page_abs}:${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 ] 2>&-; then - row="${row}outdated${ldate%% +*}" + row="${row}$(_ outdated)${ldate%%[+.]*}" [ "$rowstate" = "${rowstate%*outdated*}" ] && rowstate="${rowstate}${rowstate:+ }outdated" else - row="${row}current${ldate%% +*}" + row="${row}$(_ current)${ldate%%[+.]*}" [ "$rowstate" = "${rowstate%*current*}" ] && rowstate="${rowstate}${rowstate:+ }current" fi else - row="${row}missing" + row="${row}$(_ missing)" [ "$rowstate" = "${rowstate%*missing*}" ] && rowstate="${rowstate}${rowstate:+ }missing" fi done