From: Paul Hänsch Date: Mon, 23 May 2022 17:32:18 +0000 (+0200) Subject: revision display X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=5e41ef419be25a2c23c8eff06acb5ebadf523f5a;p=shellwiki revision display --- diff --git a/handlers/20_revision.sh b/handlers/20_revision.sh index b34b2b9..dd78b92 100644 --- a/handlers/20_revision.sh +++ b/handlers/20_revision.sh @@ -2,7 +2,7 @@ case "${PATH_INFO}" in */\[revision\]/) - REDIRECT "${_BASE}/${PATH_INFO%/}" + REDIRECT "${_BASE}${PATH_INFO%/}" ;; */\[revision\]) if ! acl_read "${PATH_INFO%\[revision\]}"; then @@ -12,7 +12,24 @@ case "${PATH_INFO}" in fi return 0 ;; - */[revision]/*):;; + */\[revision\]/\[*\]|*/\[revision\]/*/*) + REDIRECT "${_BASE}${PATH_INFO%%\[revision\]/*}${PATH_INFO##*/\[revision\]/}" + ;; + */\[revision\]/*) + page="${PATH_INFO%\[revision\]/*}" + rev="${PATH_INFO##*/}" + if ! acl_read "${page}"; then + theme_error 403 + else + ( export PATH_INFO="${page}" + cd "${_DATA}/pages${page}" + git show "${rev}:./#page.md" \ + | { printf '
'; md; printf '
'; } \ + | theme_page - "${page##*/}" + ) + fi + return 0 + ;; esac return 1 diff --git a/macros/revisions b/macros/revisions index 2bd83f5..9a5730f 100755 --- a/macros/revisions +++ b/macros/revisions @@ -22,6 +22,6 @@ printf '\n'