]> git.plutz.net Git - shellwiki/blobdiff - macros/revisions
universal page_title function
[shellwiki] / macros / revisions
index 75440d60609fcb070d79dd2a23aaa3278eaf5925..33b4b4ba1623c01fd734eb567458f03b38f55442 100755 (executable)
@@ -1,9 +1,26 @@
 #!/bin/sh
 
+# Copyright 2022 - 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"
+
 LIST=true DIFF=
 while [ $# -gt 0 ]; do case $1 in
   --list)
@@ -37,7 +54,8 @@ fi
 printf '<div class="macro revisions">\n'
 
 if [ "$REV_PAGES" != true ]; then
-  printf '<div class="error">GIT is not available to handle revisioning.</div>'
+  printf '<div class="error">%s</div>' "$(_ GIT is not available to handle revisioning.)"
+  exit 1
 fi
 
 if [ "$LIST" = true ]; then
@@ -57,7 +75,7 @@ fi
 
 if [ "$DIFF" = true -a "$LANGUAGE_DEFAULT" -a "$page_default" != "$page_abs" ]; then
   commit="$(git -C "$_DATA" log --pretty=format:%H -- "pages${page_abs}#page.md" |head -n1)"
-  printf '<section class="diff"><h2>Latest changes to original language page</h2>'
+  printf '<section class="diff"><h2>%s</h2>' "$(_ 'Latest changes to the original language page')"
   git -C "$_DATA" diff -U3 "$commit" -- "pages${page_default}#page.md" |tail -n+5 \
   | while read -r diff; do case $diff in
     @@\ *\ @@*)