X-Git-Url: http://git.plutz.net/?a=blobdiff_plain;f=markdown.awk;h=3fa248d25f2877fdc0e6f7eab9a5642635407d75;hb=d0b1c70cb4f2615f6bd1ea52b54c96de6937e12b;hp=7d7e0a5f56d5e70b7e0be4d1d104164a5718b13b;hpb=2ea88f760e5b796c42e6cd9c2237fc4b26a26e20;p=cgilite diff --git a/markdown.awk b/markdown.awk index 7d7e0a5..3fa248d 100755 --- a/markdown.awk +++ b/markdown.awk @@ -93,6 +93,7 @@ function URL ( text ) { gsub( /&/, "%26", text ); gsub( /"/, "%22", text ); gsub( /'/, "%27", text ); + gsub( /`/, "%60", text ); gsub( /\?/, "%3F", text ); gsub( /#/, "%23", text ); gsub( /\[/, "%5B", text ); @@ -115,8 +116,8 @@ function inline( line, LOCAL, len, code, href, guard ) { return ""; # omit processing of escaped characters - } else if ( line ~ /^\\[]\\`\*_\{\}\(\)#\+-\.![]/) { - return substr(line, 2, 1) inline( substr(line, 3) ); + } else if ( line ~ /^\\./) { + return HTML(substr(line, 2, 1)) inline( substr(line, 3) ); # hard brakes } else if ( match(line, /^ \n/) ) { @@ -130,7 +131,7 @@ function inline( line, LOCAL, len, code, href, guard ) { code = substr( line, len + 1, match( substr(line, len + 1), guard ) - 1) len = 2 * length(guard) + length(code) # strip single surrounding white spaces - code = gensub( / (.*) /, "\\1", "1" , code) + code = gensub( /^ | $/, "", "g" , code) # escape HTML within code span gsub( /&/, "\\&", code ); gsub( //, "\\>", code ); return "" code "" inline( substr( line, len + 1 ) )