]> git.plutz.net Git - shellwiki/commitdiff
stub for changelog and translation info
authorPaul Hänsch <paul@plutz.net>
Mon, 14 Aug 2023 23:40:28 +0000 (01:40 +0200)
committerPaul Hänsch <paul@plutz.net>
Mon, 14 Aug 2023 23:40:28 +0000 (01:40 +0200)
macros/changes [new file with mode: 0755]

diff --git a/macros/changes b/macros/changes
new file mode 100755 (executable)
index 0000000..be4dfec
--- /dev/null
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+. "$_EXEC/cgilite/cgilite.sh"
+. "$_EXEC/tools.sh"
+. "$_EXEC/acl.sh"
+
+LANGUAGES=''
+
+glob="/" depth=-1
+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;;
+esac; done
+
+printf '<table><thead>\n<th>Page</th>'
+for l in $LANGUAGES; do printf '<th>%s</th>' "$l"; done
+printf '\n</thead><tbody>\n'
+
+page_glob "$glob" "$depth" |while read page; do
+  acl_read "$page" || continue
+
+  printf '<tr>'
+  read ostamp odate <<-EOF
+       $(git -C "$_DATA" log --pretty="format:%at %ar" -- "pages/${page}#page.md")
+       EOF
+  printf '<td><a href="%s">%s</a><span>%s</span></td>' "$(HTML "$page")" "$(HTML "$page")" "${odate}"
+  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")
+       EOF
+      if [ $lstamp -lt $ostamp ]; then
+        printf '<td><a href="%s">outdated</a><span>%s</span></td>' "$(HTML "${page}:${l}")" "$ldate"
+      else
+        printf '<td><a href="%s">current</a><span>%s</span></td>' "$(HTML "${page}:${l}")" "$ldate"
+      fi
+    else
+      printf '<td><a href="%s">missing</a></td>' "$(HTML "${page}:${l}")"
+    fi
+  done
+
+  printf '</tr>\n'
+done
+
+printf '</tbody></table>'