X-Git-Url: https://git.plutz.net/?a=blobdiff_plain;f=handlers%2F10_page.sh;h=004dd03ced270f3b524b2b0b33b9ed07c75c7791;hb=5cf6de21a08325c9952aa2ed16ff2c69979d0599;hp=b34aa1b21dac7fc054261ebb566fa4ed4d00fbf4;hpb=6cbf25e916de4d4d70daf9a924302de9ca7c20f3;p=shellwiki diff --git a/handlers/10_page.sh b/handlers/10_page.sh index b34aa1b..004dd03 100755 --- a/handlers/10_page.sh +++ b/handlers/10_page.sh @@ -7,14 +7,6 @@ export WIKI_THEME=${WIKI_THEME:-default} . "$_EXEC/themes/${WIKI_THEME}.sh" -if [ "$(which awk)" ]; then - md() { awk -f "$_EXEC/md_macros.awk" -f "$_EXEC/cgilite/markdown.awk"; } -elif [ "$(which busybox)" ]; then - md() { busybox awk -f "$_EXEC/md_macros.awk" -f "$_EXEC/cgilite/markdown.awk"; } -else - md() { cat; } -fi - wiki() { # Print content of a wiki page # Get page from data or underlay dir, handle caching @@ -34,8 +26,8 @@ wiki() { mkdir -p -- "$_DATA/pages/$page/" # Macros expect to find page directory as working dir ( cd -- "$_DATA/pages/$page/"; - sed -E '1,20{ /^%[a-z]+/d; }' "$mdfile" \ - | md |tee -- "${cache}.$$" + md <"$mdfile" \ + | tee -- "${cache}.$$" ) grep -q '^%nocache' "$mdfile" \ && rm -- "${cache}.$$" \ @@ -48,6 +40,11 @@ case "${PATH_INFO}" in FILE "${_EXEC}/${PATH_INFO#/\[.\]}" return 0 ;; + *${BR}*) + export ERROR_MSG='Page names containing newline character are not allowed' + theme_error 400 + return 0 + ;; */\#*) export ERROR_MSG='Page names starting with "#" are not allowed' theme_error 400