From: Paul Hänsch Date: Tue, 10 May 2022 22:20:21 +0000 (+0200) Subject: nocache pragma X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=ea958d314bc1ca006af61d0c67c4a48c7a42b15f;p=shellwiki nocache pragma --- diff --git a/index.cgi b/index.cgi index b1b2c2d..90f7d77 100755 --- a/index.cgi +++ b/index.cgi @@ -61,9 +61,12 @@ wiki() { mkdir -p -- "$_DATA/pages/$page/" # Macros expect to find page directory as working dir ( cd -- "$_DATA/pages/$page/"; - md <"$mdfile" |tee -- "${cache}.$$" + sed -E '1,20{ /^%[a-z]+/d; }' "$mdfile" \ + | md |tee -- "${cache}.$$" ) - mv -- "${cache}.$$" "${cache}" + grep -q '^%nocache' "$mdfile" \ + && rm -- "${cache}.$$" \ + || mv -- "${cache}.$$" "${cache}" fi } @@ -71,16 +74,18 @@ case "${PATH_INFO}" in /"[.]"/*) FILE "${_EXEC}/${PATH_INFO#/\[.\]}" ;; + */\[*\]/) :;; */) theme_page "${PATH_INFO}" + exit 0 ;; */"[login]") - [ "$USER_NAME" ] \ - && REDIRECT "./" \ - || theme_login + theme_login + exit 0 ;; */"[register]") theme_register + exit 0 ;; */"#"*) : # TODO: Invalid page name