From fc3451c360c190736b7355c318f937fe304bb3c4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Wed, 30 Aug 2023 17:31:06 +0200 Subject: [PATCH] discriminate between different list markers --- markdown.awk | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/markdown.awk b/markdown.awk index 4b180eb..c42aa5a 100755 --- a/markdown.awk +++ b/markdown.awk @@ -690,12 +690,22 @@ function _block( block, LOCAL, st, len, text, title, attrib, href, guard, code, list = substr( block, 1, RLENGTH); block = substr( block, RLENGTH + 1); return "\n
\n" _dlist( list ) "
\n" _block( block ); - # Unordered list - } else if ( text = _startlist( block, "ul", "[-+*]", "([0-9]+\\.|#\\.)") ) { + # Unordered list types + } else if ( text = _startlist( block, "ul", "-", "([+*]|[0-9]+\\.|#\\.|[0-9]+\\)|#\\))") ) { + return text; + } else if ( text = _startlist( block, "ul", "\\+", "([-*]|[0-9]+\\.|#\\.|[0-9]+\\)|#\\))") ) { + return text; + } else if ( text = _startlist( block, "ul", "\\*", "([-+]|[0-9]+\\.|#\\.|[0-9]+\\)|#\\))") ) { return text; - # Ordered list - } else if ( text = _startlist( block, "ol", "([0-9]+\\.|#\\.)", "[-+*]") ) { + # Ordered list types + } else if ( text = _startlist( block, "ol", "[0-9]+\\.", "([-+*]|#\\.|[0-9]+\\)|#\\))") ) { + return text; + } else if ( text = _startlist( block, "ol", "[0-9]+\\)", "([-+*]|[0-9]+\\.|#\\.|#\\))") ) { + return text; + } else if ( text = _startlist( block, "ol", "#\\.", "([-+*]|[0-9]+\\.|[0-9]+\\)|#\\))") ) { + return text; + } else if ( text = _startlist( block, "ol", "#\\)", "([-+*]|[0-9]+\\.|#\\.|[0-9]+\\))") ) { return text; # Split paragraphs -- 2.39.2