From: Paul Hänsch Date: Wed, 30 Aug 2023 14:02:19 +0000 (+0200) Subject: allow block lists (again) X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=8e79399f2cf87e6d8715b7daeb62ee39f3436a6b;p=cgilite allow block lists (again) --- diff --git a/markdown.awk b/markdown.awk index eb40210..57a04e9 100755 --- a/markdown.awk +++ b/markdown.awk @@ -41,7 +41,7 @@ # - [x] Automatic
-wrapping (custom) # - ? Heading identifiers (php md, pandoc) # - [x] Heading attributes (custom) -# - [ ]
ends section +# - [ ]
terminates section # - [x] Automatic heading identifiers (custom) # - [x] Fenced code blocks (php md, pandoc) # - [x] Fenced code attributes @@ -741,10 +741,11 @@ function _block( block, LOCAL, st, len, text, title, attrib, href, guard, code, } } -function _list (block, mark, LOCAL, len, st, text, indent, task) { +function _list (block, mark, p, LOCAL, len, st, text, indent, task) { if ( match(block, "^([ \t]*\n)*$")) return; match(block, "^" mark "[ \t]"); indent = RLENGTH; sub("^" mark "[ \t]", "", block); + if (match(block, /\n[ \t]*\n/)) p = 1; match( block, "\n" mark "[ \t][^\n]+(\n|$)" \ "(([ \t]*\n)* ? ? ?" mark "[ \t][^\n]+(\n|$)" \ @@ -763,10 +764,10 @@ function _list (block, mark, LOCAL, len, st, text, indent, task) { sub(/^\[[-? /xX]\]/, "", text); text = _nblock( text ); - if (match( text, "^

(]|\n$" )) + if ( ! p && match( text, "^

(]|\n$" )) gsub( "(^

|

\n$)", "", text); - return task text "\n" _list(block, mark); + return task text "\n" _list(block, mark, p); } function _dlist (block, LOCAL, len, st, text, indent, p) {