]> git.plutz.net Git - shellwiki/blob - macros/changes
stub for changelog and translation info
[shellwiki] / macros / changes
1 #!/bin/sh
2
3 . "$_EXEC/cgilite/cgilite.sh"
4 . "$_EXEC/tools.sh"
5 . "$_EXEC/acl.sh"
6
7 LANGUAGES=''
8
9 glob="/" depth=-1
10 while [ $# -gt 0 ]; do case $1 in
11   --system) glob_system_pages=true; shift 1;;
12   :*) LANGUAGES="${LANGUAGES}${LANGUAGES:+ }${1#:}"; shift 1;;
13   --depth) depth="$2"; shift 2;;
14   *) glob="$1"; shift 1;;
15 esac; done
16
17 printf '<table><thead>\n<th>Page</th>'
18 for l in $LANGUAGES; do printf '<th>%s</th>' "$l"; done
19 printf '\n</thead><tbody>\n'
20
21 page_glob "$glob" "$depth" |while read page; do
22   acl_read "$page" || continue
23
24   printf '<tr>'
25   read ostamp odate <<-EOF
26         $(git -C "$_DATA" log --pretty="format:%at %ar" -- "pages/${page}#page.md")
27         EOF
28   printf '<td><a href="%s">%s</a><span>%s</span></td>' "$(HTML "$page")" "$(HTML "$page")" "${odate}"
29  
30   for l in $LANGUAGES; do
31     if [ -f "${_DATA}/pages/${page}:${l}/#page.md" ]; then
32       read lstamp ldate <<-EOF
33         $(git -C "$_DATA" log --pretty="format:%at %ar" -- "pages/${page}:${l}/#page.md")
34         EOF
35       if [ $lstamp -lt $ostamp ]; then
36         printf '<td><a href="%s">outdated</a><span>%s</span></td>' "$(HTML "${page}:${l}")" "$ldate"
37       else
38         printf '<td><a href="%s">current</a><span>%s</span></td>' "$(HTML "${page}:${l}")" "$ldate"
39       fi
40     else
41       printf '<td><a href="%s">missing</a></td>' "$(HTML "${page}:${l}")"
42     fi
43   done
44
45   printf '</tr>\n'
46 done
47
48 printf '</tbody></table>'