X-Git-Url: https://git.plutz.net/?a=blobdiff_plain;f=cgilite%2Fmarkdown.awk;h=7e29c572213e553df07563099cf52683ed11b960;hb=38e8338380e35f9c3c55c6232121cb7575d5cbfb;hp=75f182746bd29d9375c7af1b1e52c39737fb2a58;hpb=08e02da11207d97b7c7d4db58619cdb0a59476e2;p=shellwiki
diff --git a/cgilite/markdown.awk b/cgilite/markdown.awk
index 75f1827..7e29c57 100755
--- a/cgilite/markdown.awk
+++ b/cgilite/markdown.awk
@@ -178,12 +178,12 @@ function inline( line, LOCAL, len, text, code, href, guard ) {
return substr( line, 1, len) inline(substr(line, len + 1));
# inline links
- } else if ( match(line, "^" lii "\\([\\n\\t ]*" lid "([\\n\\t ]+" lit ")?[\\n\\t ]*\\)") ) {
+ } else if ( match(line, "^" lii "\\([\n\t ]*" lid "([\n\t ]+" lit ")?[\n\t ]*\\)") ) {
len = RLENGTH;
text = href = title = substr( line, 1, len);
- sub("^\\[", "", text); sub("\\]\\([\\n\\t ]*" lid "([\\n\\t ]+" lit ")?[\\n\\t ]*\\)$", "", text);
- sub("^" lii "\\([\\n\\t ]*", "", href); sub("([\\n\\t ]+" lit ")?[\\n\\t ]*\\)$", "", href);
- sub("^" lii "\\([\\n\\t ]*" lid, "", title); sub("[\\n\\t ]*\\)$", "", title); sub("^[\\n\\t ]+", "", title);
+ sub("^\\[", "", text); sub("\\]\\([\n\t ]*" lid "([\n\t ]+" lit ")?[\n\t ]*\\)$", "", text);
+ sub("^" lii "\\([\n\t ]*", "", href); sub("([\n\t ]+" lit ")?[\n\t ]*\\)$", "", href);
+ sub("^" lii "\\([\n\t ]*" lid, "", title); sub("[\n\t ]*\\)$", "", title); sub("^[\n\t ]+", "", title);
if ( match(href, /^<.*>$/) ) { sub(/^, "", href); sub(/>$/, "", href); }
if ( match(title, /^".*"$/) ) { sub(/^"/, "", title); sub(/"$/, "", title); }
@@ -210,20 +210,20 @@ function inline( line, LOCAL, len, text, code, href, guard ) {
}
# inline images
- } else if ( match(line, "^!" lix "\\([\\n\\t ]*" lid "([\\n\\t ]+" lit ")?[\\n\\t ]*\\)(\\{[a-zA-Z \\t-]*\\})?") ) {
+ } else if ( match(line, "^!" lix "\\([\n\t ]*" lid "([\n\t ]+" lit ")?[\n\t ]*\\)(\\{[a-zA-Z \t-]*\\})?") ) {
len = RLENGTH; text = href = title = attrib = substr( line, 1, len);
sub("^!\\[", "", text);
- sub("\\]\\([\\n\\t ]*" lid "([\\n\\t ]+" lit ")?[\\n\\t ]*\\)(\\{[a-zA-Z \\t-]*\\})?$", "", text);
+ sub("\\]\\([\n\t ]*" lid "([\n\t ]+" lit ")?[\n\t ]*\\)(\\{[a-zA-Z \t-]*\\})?$", "", text);
- sub("^!" lix "\\([\\n\\t ]*", "", href);
- sub("([\\n\\t ]+" lit ")?[\\n\\t ]*\\)(\\{[a-zA-Z \\t-]*\\})?$", "", href);
+ sub("^!" lix "\\([\n\t ]*", "", href);
+ sub("([\n\t ]+" lit ")?[\n\t ]*\\)(\\{[a-zA-Z \t-]*\\})?$", "", href);
- sub("^!" lix "\\([\\n\\t ]*" lid, "", title);
- sub("[\\n\\t ]*\\)(\\{[a-zA-Z \\t-]*\\})?$", "", title);
- sub("^[\\n\\t ]+", "", title);
+ sub("^!" lix "\\([\n\t ]*" lid, "", title);
+ sub("[\n\t ]*\\)(\\{[a-zA-Z \t-]*\\})?$", "", title);
+ sub("^[\n\t ]+", "", title);
- sub("^!" lix "\\([\\n\\t ]*" lid "([\\n\\t ]+" lit ")?[\\n\\t ]*\\)", "", attrib);
+ sub("^!" lix "\\([\n\t ]*" lid "([\n\t ]+" lit ")?[\n\t ]*\\)", "", attrib);
sub(/^\{[ \t]*/, "", attrib); sub(/[ \t]*\}$/, "", attrib); gsub(/[ \t]+/, " ", attrib);
if ( match(href, /^<.*>$/) ) { sub(/^, "", href); sub(/>$/, "", href); }
@@ -231,9 +231,10 @@ function inline( line, LOCAL, len, text, code, href, guard ) {
else if ( match(title, /^'.*'$/) ) { sub(/^'/, "", title); sub(/'$/, "", title); }
else if ( match(title, /^\(.*\)$/) ) { sub(/^\(/, "", title); sub(/\)$/, "", title); }
- gsub(/\\/, "", href); gsub(/\\/, "", title); gsub(/[\n\t]+/, " ", title);
+ gsub(/^[\t ]+$/, "", text); gsub(/\\/, "", href);
+ gsub(/\\/, "", title); gsub(/[\n\t]+/, " ", title);
- return "" inline( substr( line, len + 1) );
@@ -638,21 +639,21 @@ function _block( block, LOCAL, st, len, text, title, attrib, href, guard, code,
return headline( n, text, 0 ) _block( substr( block, len + 1) );
# block images (wrapped in