From: Paul Hänsch Date: Thu, 29 Aug 2024 10:45:08 +0000 (+0200) Subject: additional checks, minor "bug"fix: no newline befor definition lists (for consistency) X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=71c7ca60ee7376e86ea34572cfdf08304df59dd1;p=cgilite additional checks, minor "bug"fix: no newline befor definition lists (for consistency) --- diff --git a/markdown.awk b/markdown.awk index cb2a8f6..d54d125 100755 --- a/markdown.awk +++ b/markdown.awk @@ -706,7 +706,7 @@ function _block( block, LOCAL, st, len, text, title, attrib, href, guard, code, "|([ \t]*\n)+( ? ? ?\t| +)[^\n]+(\n|$))*)+" \ )) { list = substr( block, 1, RLENGTH); block = substr( block, RLENGTH + 1); - return "\n
\n" _dlist( list ) "
\n" _block( block ); + return "
\n" _dlist( list ) "
\n" _block( block ); # Unordered list types } else if ( text = _startlist( block, "ul", "-", "([+*•]|[0-9]+\\.|#\\.|[0-9]+\\)|#\\))") ) { diff --git a/tests-markdown.sh b/tests-markdown.sh index f5fc829..0147f09 100755 --- a/tests-markdown.sh +++ b/tests-markdown.sh @@ -161,4 +161,67 @@ assert '![Testbild *ARD*](Test Bild.jpg){tv ard function-check}' \ # '
Testbild *ARD*
' \ # "block image tagged" +# Headings +assert 'Heading first Order +============' \ +'

Heading first Order

+
' \ +'Heading h1' + +assert 'Heading first Order {.foo #bar} +============' \ +'

Heading first Order

+
' \ +'Heading h1 + attributes' + +assert 'Heading second Order +------------' \ +'

Heading second Order

+
' \ +'Heading h2' + +assert 'Heading second Order {.foo #bar} +------------' \ +'

Heading second Order

+
' \ +'Heading h2 + attributes' + +assert '#### Heading four' \ +'

Heading four

+
' \ +'Heading arbitrary' + +assert '### Heading three ######' \ +'

Heading three

+
' \ +'Heading arbitrary' + +assert '### Heading three ## {foo bar}' \ +'

Heading three

+
' \ +'Heading arbitrary + attributes' + +assert '# Heading \# # {foo bar}' \ +'

Heading #

+
' \ +'Heading arbitrary + attributes' + +assert 'Definition +: term +with line continuation + +: second term + +foo +: bar' \ +'
+
Definition
+
term +with line continuation
+
second term
+
foo
+
bar
+
' \ +'Definition List' + printf '\nAll test passed!\n'