From: Paul Hänsch Date: Mon, 28 Aug 2023 15:45:10 +0000 (+0200) Subject: Squashed 'cgilite/' changes from ae55f6f3..887a68a1 X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=b3ba9fc1e29e96ca943bdb8bc1a5f3ff31196698;p=shellwiki Squashed 'cgilite/' changes from ae55f6f3..887a68a1 887a68a1 tidy up variable declarations, remove additional line break after headline git-subtree-dir: cgilite git-subtree-split: 887a68a142e6eb59aecd1757b591ab7ab37cd279 --- diff --git a/markdown.awk b/markdown.awk index be7d723..ae1cb93 100755 --- a/markdown.awk +++ b/markdown.awk @@ -323,7 +323,7 @@ function headline( hlvl, htxt, attrib, LOCAL, sec, n, HL) { return sec "
" \ "" inline( htxt ) \ "" \ - "\n\n"; + "\n"; } # Nested Block, resets heading counters @@ -342,7 +342,7 @@ function _nblock( block, LOCAL, hlsav, sec, n ) { return block sec; } -function _block( block, LOCAL, st, len, hlvl, htxt, sec, guard, code, indent, attrib ) { +function _block( block, LOCAL, st, len, text, title, attrib, href, guard, code, indent ) { gsub( /^\n+|\n+$/, "", block ); if ( block == "" ) { @@ -514,11 +514,11 @@ function _block( block, LOCAL, st, len, hlvl, htxt, sec, guard, code, indent, at # Line Blocks (pandoc) } else if ( match(block, /^\| [^\n]*(\n|$)(\| [^\n]*(\n|$)|[ \t]+[^\n[:space:]][^\n]*(\n|$))*/) ) { len = RLENGTH; st = RSTART; - code = substr(block, 1, len); - gsub(/\n[[:space:]]+/, " ", code); - gsub(/\n\| /, "\n", code); - gsub(/^\| |\n$/, "", code); - return "
" gensub(/\n/, "
\n", "g", inline( code )) "
\n" \ + text = substr(block, 1, len); + gsub(/\n[[:space:]]+/, " ", text); + gsub(/\n\| /, "\n", text); + gsub(/^\| |\n$/, "", text); + return "
" gensub(/\n/, "
\n", "g", inline( text )) "
\n" \ _block( substr( block, len + 1) ); # Indented Code Block