From 9e77ca6a2a9135e1bd9d4cf5ff48ef2f46ce885f Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Thu, 19 Jan 2017 05:30:29 -0800 Subject: [PATCH] Markdown.pl: do not mishandle double list markers redux In b7f3fc1c (Markdown.pl: do not mishandle double list markers, 2017-01-09, markdown_1.1.0), an attempt was made to avoid having something like "* 1. item" be misinterpreted as an unordered list containing an ordered sublist. However, the change made to fix the problem only introduced another problem where lists were not always being recognized when they should be. Fix the fix (it did have a bit of a kludgely side to it) so it works properly and is less kludgely. Signed-off-by: Kyle J. McKay --- Markdown.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Markdown.pl b/Markdown.pl index 7eb1364..c32ea07 100755 --- a/Markdown.pl +++ b/Markdown.pl @@ -452,7 +452,7 @@ sub Markdown { # Strip link definitions, store in hashes. $text = _StripLinkDefinitions($text); - $text = _RunBlockGamut("\n".$text, 1); + $text = _RunBlockGamut($text, 1); # Unhashify code blocks $text =~ s/(\005\d+\006)/$g_code_blocks{$1}/g; @@ -1337,7 +1337,7 @@ sub _DoLists { my $whole_list = qr{ ( # $1 (or $_[0]) = whole list ( # $2 (or $_[1]) - (?<=\n) + (?:(?<=\n)|\A) [ ]{0,$less_than_indent} (${marker_any}) # $3 (or $_[2]) = first list item marker [ ]+