From: Paul Hänsch Date: Thu, 18 May 2023 12:04:37 +0000 (+0200) Subject: enable block element Macros X-Git-Url: http://git.plutz.net/?p=cgilite;a=commitdiff_plain;h=01dadd76ff332d89503364a794423564f01805ea enable block element Macros --- diff --git a/markdown.awk b/markdown.awk index fa60543..b507266 100755 --- a/markdown.awk +++ b/markdown.awk @@ -608,6 +608,12 @@ function _block( block, LOCAL, st, len, hlvl, htxt, guard, code, indent, attrib return "

" HTML(substr(block, 1, len)) "

\n" _block( substr(block, len + 1) ); } + # Macros (standalone <> calls handled as block, so they are not wrapped in paragraph) + } else if ( AllowMacros && match( block, /^<<(([^>]|>[^>])+)>>(\n|$)/) ) { + len = RLENGTH; + text = gensub(/^<<(([^>]|>[^>])+)>>(\n.*)?$/, "\\1", 1, block); + return macro(text) _block(substr(block, len + 1)); + # Split paragraphs } else if ( match( block, /(^|\n)[[:space:]]*(\n|$)/) ) { len = RLENGTH; st = RSTART;