From 9c54db6ec648c690cc3111faa19c3312d51d041e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Tue, 15 Aug 2023 13:09:33 +0200 Subject: [PATCH] styling for <> macro --- macros/changes | 32 ++++++++++++++++++-------------- themes/default.css | 17 +++++++++++++++++ 2 files changed, 35 insertions(+), 14 deletions(-) diff --git a/macros/changes b/macros/changes index be4dfec..c1e6946 100755 --- a/macros/changes +++ b/macros/changes @@ -4,9 +4,7 @@ . "$_EXEC/tools.sh" . "$_EXEC/acl.sh" -LANGUAGES='' - -glob="/" depth=-1 +LANGUAGES='' glob="/" depth=-1 while [ $# -gt 0 ]; do case $1 in --system) glob_system_pages=true; shift 1;; :*) LANGUAGES="${LANGUAGES}${LANGUAGES:+ }${1#:}"; shift 1;; @@ -14,35 +12,41 @@ while [ $# -gt 0 ]; do case $1 in *) glob="$1"; shift 1;; esac; done -printf '\n' +page='' page_abs='' ostamp='' odate='' lstamp='' ldate='' row='' rowstate='' + +printf '
Page
\n' for l in $LANGUAGES; do printf '' "$l"; done printf '\n\n' page_glob "$glob" "$depth" |while read page; do - acl_read "$page" || continue + page_abs="$(page_abs "$page")" + acl_read "${page_abs}" || continue - printf '' read ostamp odate <<-EOF - $(git -C "$_DATA" log --pretty="format:%at %ar" -- "pages/${page}#page.md") + $(git -C "$_DATA" log --pretty="format:%at %ai" -- "pages${page_abs}#page.md") EOF - printf '' "$(HTML "$page")" "$(HTML "$page")" "${odate}" + row="" + 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 %ar" -- "pages/${page}:${l}/#page.md") + $(git -C "$_DATA" log --pretty="format:%at %ai" -- "pages$(page_abs "${page_abs}:${l}")/#page.md") EOF - if [ $lstamp -lt $ostamp ]; then - printf '' "$(HTML "${page}:${l}")" "$ldate" + if [ $lstamp -lt $ostamp ] 2>&-; then + row="${row}" + [ "$rowstate" = "${rowstate%*outdated*}" ] && rowstate="${rowstate}${rowstate:+ }outdated" else - printf '' "$(HTML "${page}:${l}")" "$ldate" + row="${row}" + [ "$rowstate" = "${rowstate%*current*}" ] && rowstate="${rowstate}${rowstate:+ }current" fi else - printf '' "$(HTML "${page}:${l}")" + row="${row}" + [ "$rowstate" = "${rowstate%*missing*}" ] && rowstate="${rowstate}${rowstate:+ }missing" fi done - printf '\n' + printf '%s\n' "$rowstate" "$row" done printf '
Page%s
%s%s$(HTML "$page")${odate%% +*}outdated%soutdated${ldate%% +*}current%scurrent${ldate%% +*}missingmissing
' diff --git a/themes/default.css b/themes/default.css index 3e924b5..4c94580 100644 --- a/themes/default.css +++ b/themes/default.css @@ -249,6 +249,7 @@ main pre { .macro.toc li.h5 { margin-left: 5em; } .macro.toc li.h6 { margin-left: 6.25em; } + .macro.gallery { text-align: center; margin: 2em 0; @@ -259,3 +260,19 @@ main pre { max-height: 9em; margin: 0 .25em; } + + +.macro.changes td .date { + display: block; + font-size: .75em; +} +.macro.changes td.outdated, +.macro.changes td.current, +.macro.changes td.missing { + text-align: center; +} +.macro.changes th { background-color: #EEF; } +.macro.changes td { background-color: #DFF; } +.macro.changes td.outdated { background-color: #FFD; } +.macro.changes td.current { background-color: #DFD; } +.macro.changes td.missing { background-color: #FDD; } -- 2.39.2