From 71c7ca60ee7376e86ea34572cfdf08304df59dd1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Thu, 29 Aug 2024 12:45:08 +0200 Subject: [PATCH] additional checks, minor "bug"fix: no newline befor definition lists (for consistency) --- markdown.awk | 2 +- tests-markdown.sh | 63 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 1 deletion(-) 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' -- 2.39.2