X-Git-Url: https://git.plutz.net/?a=blobdiff_plain;ds=sidebyside;f=markdown.awk;h=b0647922efdcbf5859dac4d3cda72145035403ed;hb=1f887be68c8e777cdaa6853eb942f7b691bc1e4e;hp=b3166f9e6c8580b919b960df50229750a7a1e3c8;hpb=11ee170457db15ac24e30a97c7fb555972da83b7;p=shellwiki
diff --git a/markdown.awk b/markdown.awk
index b3166f9..b064792 100755
--- a/markdown.awk
+++ b/markdown.awk
@@ -56,6 +56,7 @@
# - [ ] Definition lists (php md, pandoc)
# - [-] Numbered example lists (pandoc)
# - [-] Metadata blocks (pandoc)
+# - [x] Metadata blocks (custom)
# - [x] Fenced Divs (pandoc)
#
# Extensions - Inline elements:
@@ -279,6 +280,12 @@ function _block( block, LOCAL, st, len, hlvl, htxt, guard, code, indent, attrib
} else if ( AllowHTML && match( block, /^ ? ? ?(<\/[A-Za-z][A-Za-z0-9-]*[[:space:]]*>|<[A-Za-z][A-Za-z0-9-]*([[:space:]]+[A-Za-z_:][A-Za-z0-9_\.:-]*([[:space:]]*=[[:space:]]*([[:space:]"'=<>`]+|"[^"]*"|'[^']*'))?)*[[:space:]]*\/?>)([[:space:]]*\n)([^\n]|\n[ \t]*[^\n])*(\n[[:space:]]*\n|$)/) ) {
len = RLENGTH; st = RSTART;
return substr(block, st, len) _block(substr(block, st + len));
+
+ # Metadata (custom, block starting with %something)
+ # Metadata is ignored but can be interpreted externally
+ } else if ( match(block, /^%[a-zA-Z]+([[:space:]][^\n]*)?(\n|$)(%[a-zA-Z]+([[:space:]][^\n]*)?(\n|$)|%([[:space:]][^\n]*)?(\n|$)|[ \t]+[^\n[:space:]][^\n]*(\n|$))*/) ) {
+ len = RLENGTH; st = RSTART;
+ return _block( substr( block, len + 1) );
# Blockquote (leading >)
} else if ( match( block, /^> /) ) {
@@ -390,6 +397,12 @@ function _block( block, LOCAL, st, len, hlvl, htxt, guard, code, indent, attrib
return "
" inline( substr(block, 1, st - 1) ) "
\n" \ - _block( substr(block, st + len) ); + return "" inline(block) "
\n"; } }