]> git.plutz.net Git - shellwiki/commitdiff
Merge commit '61045141d11e5e7b392ee0c6f57a6c0e1424be4d'
authorPaul Hänsch <paul@plutz.net>
Thu, 24 Mar 2022 11:48:14 +0000 (12:48 +0100)
committerPaul Hänsch <paul@plutz.net>
Thu, 24 Mar 2022 11:48:14 +0000 (12:48 +0100)
1  2 
cgilite/cgilite.sh
cgilite/markdown.awk

diff --combined cgilite/cgilite.sh
index 90d65577648d2d78efa7d349e90677984f87c436,6cbd7ec27eca272bff82a98bcf08fb2b24d55a46..6cbd7ec27eca272bff82a98bcf08fb2b24d55a46
@@@ -89,7 -89,8 +89,8 @@@ HEX_DECODE()
        "$pfx"[0-9a-fA-F][0-9a-fA-F]*) in="${in#${pfx}}";;
        \\*) in="${in#?}"; out="${out}\\\\"; continue;;
         %*) in="${in#?}"; out="${out}%%";  continue;;
-         *) out="${out}${in%"${in#?}"}"; in="${in#?}"; continue;;
+         *) att="${in%%"${pfx}"*}"; att="${att%%%*}"; att="${att%%\\*}"
+            out="${out}${att}"; in="${in#"${att}"}"; continue;;
      esac;
  
      # Hex escapes for printf (e.g. \x41) are not portable 
diff --combined cgilite/markdown.awk
index b3166f9e6c8580b919b960df50229750a7a1e3c8,d28c7cfc760a2ed6c9fde6e040a2bf981c008b38..d28c7cfc760a2ed6c9fde6e040a2bf981c008b38
@@@ -390,6 -390,12 +390,12 @@@ function _block( block, LOCAL, st, len
      return "<h" hlvl " id=\"" hid " - " HTML(htxt) "\">" inline( htxt ) "</h" hlvl ">\n\n" \
             _block( substr( block, len + 1) );
  
+   # Split paragraphs
+   } else if ( match( block, /(^|\n)[[:space:]]*(\n|$)/) ) {
+     len = RLENGTH; st = RSTART;
+     return _block( substr(block, 1, st - 1) ) "\n" \
+            _block( substr(block, st + len) );
    # Horizontal rule
    } else if ( match( block, /(^|\n) ? ? ?((\* *){3,}|(- *){3,}|(_ *){3,})($|\n)/) ) {
      len = RLENGTH; st = RSTART;
  
    # Plain paragraph
    } else {
-     match( block, /(^|\n)[[:space:]]*(\n|$)/ ) || match( block, /$/ );
-     len = RLENGTH; st = RSTART;
-     return "<p>" inline( substr(block, 1, st - 1) ) "</p>\n" \
-            _block( substr(block, st + len) );
+     return "<p>" inline(block) "</p>\n";
    }
  }