]> git.plutz.net Git - shellwiki/commitdiff
Merge commit 'b3ba9fc1e29e96ca943bdb8bc1a5f3ff31196698'
authorPaul Hänsch <paul@plutz.net>
Mon, 28 Aug 2023 15:45:10 +0000 (17:45 +0200)
committerPaul Hänsch <paul@plutz.net>
Mon, 28 Aug 2023 15:45:10 +0000 (17:45 +0200)
1  2 
cgilite/markdown.awk

diff --combined cgilite/markdown.awk
index be7d723b6b96d0efa7ccdc9ecc5be38c881f1026,ae1cb934132d9d54c66755a850707d77db9a5217..ae1cb934132d9d54c66755a850707d77db9a5217
@@@ -323,7 -323,7 +323,7 @@@ function headline( hlvl, htxt, attrib, 
    return sec "<section class=\"" (attrib ? "h" hlvl " " attrib : "h" hlvl)  "\" id=\"" hid "\">" \
           "<h" hlvl (attrib ? " class=\"" attrib "\"" : "") ">" inline( htxt ) \
           "<a class=\"anchor\" href=\"#" hid "\"></a>" \
-          "</h" hlvl ">\n\n";
+          "</h" hlvl ">\n";
  }
  
  # Nested Block, resets heading counters
@@@ -342,7 -342,7 +342,7 @@@ function _nblock( block, LOCAL, hlsav, 
    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 == "" ) {
    # 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 "<div class=\"line-block\">" gensub(/\n/, "<br>\n", "g", inline( code )) "</div>\n" \
+     text = substr(block, 1, len);
+     gsub(/\n[[:space:]]+/, " ", text);
+     gsub(/\n\| /, "\n", text);
+     gsub(/^\| |\n$/, "", text);
+     return "<div class=\"line-block\">" gensub(/\n/, "<br>\n", "g", inline( text )) "</div>\n" \
             _block( substr( block, len + 1) );
  
    # Indented Code Block