X-Git-Url: https://git.plutz.net/?a=blobdiff_plain;f=macros%2Fchanges;h=54f4782cf0bc0fc895b21578f9c4a3c5f03b12e5;hb=3601593ab76ccf5ea1360c6c588bd3326e5b956d;hp=562fa8f6dddf35aed439dbd57ed4f3fc008be8f2;hpb=ade7bf5a0fb735ac515d6f0bfd6e4b169989bc27;p=shellwiki diff --git a/macros/changes b/macros/changes index 562fa8f..54f4782 100755 --- a/macros/changes +++ b/macros/changes @@ -1,16 +1,36 @@ #!/bin/sh +# Copyright 2023 Paul Hänsch +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +# SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +# IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + . "$_EXEC/cgilite/cgilite.sh" . "$_EXEC/tools.sh" . "$_EXEC/acl.sh" +_(){ printf %s\\n "$*"; } +[ "${LANGUAGE}" -a -r "${_EXEC}/l10n/${LANGUAGE}.sh" ] && . "${_EXEC}/l10n/${LANGUAGE}.sh" + LANGUAGES='' glob="/" depth=-1 +set -- "$@" -- while [ $# -gt 0 ]; do case $1 in --system) glob_system_pages=true; shift 1;; :*) LANGUAGES="${LANGUAGES}${LANGUAGES:+ }${1#:}"; shift 1;; --depth) depth="$2"; shift 2;; - *) glob="$1"; shift 1;; + --) shift 1; break;; + *) set -- "$@" "$1"; shift 1;; esac; done +[ "$*" ] || set -- / page='' page_abs='' ostamp='' odate='' lstamp='' ldate='' row='' rowstate='' @@ -18,14 +38,19 @@ printf '\n' for l in $LANGUAGES; do printf '' "$l"; done printf '\n\n' -page_glob "$glob" "$depth" |while read page; do +for glob in "$@"; do + page_glob "$glob" "$depth" +done \ +| sort -u \ +| while read page; do page_abs="$(page_abs "$page")" acl_read "${page_abs}" || continue read ostamp odate <<-EOF $([ "$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" + || stat -c "%Y %y" -- "$_DATA/pages${page_abs}#page.md" 2>&- \ + || printf "0 %s\n" "$(_ "(never edited)")" ) EOF row="" @@ -40,14 +65,14 @@ page_glob "$glob" "$depth" |while read page; do ) EOF if [ $lstamp -lt $ostamp ] 2>&-; then - row="${row}" + row="${row}" [ "$rowstate" = "${rowstate%*outdated*}" ] && rowstate="${rowstate}${rowstate:+ }outdated" else - row="${row}" + row="${row}" [ "$rowstate" = "${rowstate%*current*}" ] && rowstate="${rowstate}${rowstate:+ }current" fi else - row="${row}" + row="${row}" [ "$rowstate" = "${rowstate%*missing*}" ] && rowstate="${rowstate}${rowstate:+ }missing" fi done
Page%s
$(HTML "$page")${odate%%[+.]*}outdated${ldate%%[+.]*}$(_ outdated)${ldate%%[+.]*}current${ldate%%[+.]*}$(_ current)${ldate%%[+.]*}missing$(_ missing)