From 9c46b3c13b81e117b77bd58ce782645d1f137161 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Wed, 27 Mar 2024 15:56:00 +0100 Subject: [PATCH 1/4] Bugfix: use HTML() escapes in most links instead of double escaping via URL() --- markdown.awk | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/markdown.awk b/markdown.awk index c08d856..34879d2 100755 --- a/markdown.awk +++ b/markdown.awk @@ -158,18 +158,18 @@ function inline( line, LOCAL, len, text, code, href, guard ) { href = gensub(/^\[\[([^]|]+)(\|([^]]+))?\]\]/, "\\1", 1, substr(line, 1, len) ); text = gensub(/^\[\[([^]|]+)(\|([^]]+))?\]\]/, "\\3", 1, substr(line, 1, len) ); if ( ! text ) text = href; - return "" HTML(text) "" inline( substr( line, len + 1) ); + return "" HTML(text) "" inline( substr( line, len + 1) ); # quick links ("automatic links" in md doc) } else if ( match( line, /^<[a-zA-Z]+:\/\/([-\.[:alnum:]]+)(:[0-9]*)?(\/[^>]*)?>/ ) ) { len = RLENGTH; - href = URL( substr( line, 2, len - 2) ); + href = HTML( substr( line, 2, len - 2) ); return "" href "" inline( substr( line, len + 1) ); # quick link email } else if ( match( line, /^<[a-zA-Z0-9.!#$%&'\''*+\/=?^_`{|}~-]+@[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*>/ ) ) { len = RLENGTH; - href = URL( substr( line, 2, len - 2) ); + href = HTML( substr( line, 2, len - 2) ); return "" href "" inline( substr( line, len + 1) ); # Verbatim inline HTML @@ -192,7 +192,7 @@ function inline( line, LOCAL, len, text, code, href, guard ) { gsub(/\\/, "", href); gsub(/\\/, "", title); gsub(/[\n\t]+/, " ", title); - return "" \ + return "" \ inline( text ) "" inline( substr( line, len + 1) ); # reference style links @@ -202,9 +202,9 @@ function inline( line, LOCAL, len, text, code, href, guard ) { id = gensub(/^\[([^\n]+)\] ?\[([^\n]*)\].*/, "\\2", 1, substr(line, 1, len) ); if ( ! id ) id = text; if ( rl_href[id] && rl_title[id] ) { - return "" inline(text) "" inline( substr( line, len + 1) ); + return "" inline(text) "" inline( substr( line, len + 1) ); } else if ( rl_href[id] ) { - return "" inline(text) "" inline( substr( line, len + 1) ); + return "" inline(text) "" inline( substr( line, len + 1) ); } else { return "" HTML(substr(line, 1, len)) inline( substr(line, len + 1) ); } @@ -234,7 +234,7 @@ function inline( line, LOCAL, len, text, code, href, guard ) { gsub(/^[\t ]+$/, "", text); gsub(/\\/, "", href); gsub(/\\/, "", title); gsub(/[\n\t]+/, " ", title); - return "\""" inline( substr( line, len + 1) ); @@ -245,10 +245,10 @@ function inline( line, LOCAL, len, text, code, href, guard ) { id = gensub(/^!\[([^\n]*)\] ?\[([^\n]*)\].*/, "\\2", 1, substr(line, 1, len) ); if ( ! id ) id = text; if ( rl_href[id] && rl_title[id] ) { - return "\""" \ + return "\""" \ inline( substr( line, len + 1) ); } else if ( rl_href[id] ) { - return "\""" \ + return "\""" \ inline( substr( line, len + 1) ); } else { return "" HTML(substr(line, 1, len)) inline( substr(line, len + 1) ); @@ -663,8 +663,8 @@ function _block( block, LOCAL, st, len, text, title, attrib, href, guard, code, gsub(/^[\t ]+$/, "", text); gsub(/\\/, "", href); - return "
" \ - "\""" \ + "\""" \ (title?"
" inline(title) "
":"") \ "
\n\n" \ @@ -677,14 +677,14 @@ function _block( block, LOCAL, st, len, text, title, attrib, href, guard, code, id = gensub(/^!\[([^\n]*)\] ?\[([^\n]*)\](\n.*)?$/, "\\2", 1, block); if ( ! id ) id = text; if ( rl_href[id] && rl_title[id] ) { - return "
" \ - "\""" \ + return "
" \ + "\""" \ "
" inline(rl_title[id]) "
" \ "
\n\n" \ _block( substr( block, len + 1) ); } else if ( rl_href[id] ) { - return "
" \ - "\""" \ + return "
" \ + "\""" \ "
\n\n" \ _block( substr( block, len + 1) ); } else { -- 2.39.2 From 397847dd01a44b7a5a26b6c6d16a61a42079a542 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Tue, 9 Apr 2024 16:46:33 +0200 Subject: [PATCH 2/4] offer invitation links if email is not required --- users.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/users.sh b/users.sh index c924789..32299ff 100755 --- a/users.sh +++ b/users.sh @@ -621,7 +621,7 @@ w_user_invite(){ if [ "$(GET user_confirm)" ]; then w_user_confirm - elif [ "$USER_ID" -a "$SENDMAIL" ]; then + elif [ "$USER_ID" -a "$USER_REQUIREEMAIL" = true ]; then w_user_invite_email elif [ "$USER_ID" ]; then uid="$(timeid)" -- 2.39.2 From 1a733d66393fa87f936f19ab64b31ecdb828994f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Wed, 17 Apr 2024 16:33:29 +0200 Subject: [PATCH 3/4] debug function --- cgilite.awk | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cgilite.awk b/cgilite.awk index f16ed6a..ebf4411 100644 --- a/cgilite.awk +++ b/cgilite.awk @@ -1,5 +1,7 @@ #!/bin/env awk -f +function debug(t) { printf "%s\n", t >>"/dev/stderr"; } + function PATH( str, seg, out ) { while ( str ) { seg = str; @@ -151,8 +153,9 @@ BEGIN { split("", _GET); split("", _POST); split("", _REF); split("", _HEADER); split("", _COOKIE); - if ( ENVIRON["REQUEST_METHOD"] ) + if ( ENVIRON["REQUEST_METHOD"] ) { _cgilite_headers(); - else + } else { _cgilite_request(); + } } -- 2.39.2 From ad6888a95e36f5ad2be6555d20c9216bcd3d1aa7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Sun, 12 May 2024 17:52:28 +0200 Subject: [PATCH 4/4] style support for