From: Paul Hänsch Date: Wed, 7 Jul 2021 12:40:25 +0000 (+0200) Subject: busybox fallback for markdown awk interpreter X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=f20ef4a7beab98b061e86cda440c99d80368efc4;p=webtxt busybox fallback for markdown awk interpreter --- diff --git a/index.cgi b/index.cgi index c0b2ae4..f2e065e 100755 --- a/index.cgi +++ b/index.cgi @@ -9,7 +9,16 @@ _DATA="${_DATA:-.}" . "$_EXEC"/session_lock.sh git init "$_DATA" >/dev/null & + export MD_HTML="false" +markdown() { + local awkbin=`which awk` + if [ "$awkbin" ]; then + "$awkbin" -f "$_EXEC"/cgilite/markdown.awk + else + busybox awk -f "$_EXEC"/cgilite/markdown.awk + fi +} yield_page(){ title="${1:-WebTXT}" page="$2" @@ -119,5 +128,5 @@ yield_page "$(pagename "$doc" |HTML)" <<-EOF [input type=hidden name=session_key value="$SESSION_KEY"] [button type=submit name=action value=edit Edit] ] - [div .text . $("$_EXEC"/cgilite/markdown.awk <"$doc")] + [div .text . $(markdown <"$doc")] EOF