Browse Source

Markdown.pl: do not overlook sibling list items

When support for additional list markers was added in
51f3d63833 (Markdown.pl: support more list markers, 2017-01-10, 1.1.0),
a bug was inadvertently introduced that could cause adjacent sibling
list items to only recognize the first as a list item and as a side-effect
prevent markup from being recognized in the second.

The problem occurred when the matching pattern was split to run in
progressive matching mode and resulted in the sibling list items match
not always being matched by the progressive list item pattern (extra
possible \n's were preventing a match).

Fix this by adding a '+' in the correct location in the progressive pattern.

The side-effect was caused because any "leftover" (of which there shouldn't
be any) was not being processed for markup.

As a precaution, run any leftover through the block gamut markup processor
just in case even though there should never be any leftover.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
master
Kyle J. McKay 7 years ago
parent
commit
b5e5efa063
  1. 6
      Markdown.pl

6
Markdown.pl

@ -1506,7 +1506,7 @@ sub _ProcessListItems {
my $oldpos = 0;
pos($list_str) = 0;
while ($list_str =~ m{\G # start where we left off
(\n)? # leading line = $1
(\n+)? # leading line = $1
(^[ ]*) # leading whitespace = $2
($marker_any) [ ] ([ ]*) # list marker = $3 leading item space = $4
}cgmx) {
@ -1629,8 +1629,8 @@ sub _ProcessListItems {
if defined($first_marker_type) && $first_marker_type eq "a" && $first_marker =~ /^$greek_lower/o;
}
# Anything left over (similar to $') goes into result
$result .= substr($list_str, pos($list_str));
# Anything left over (similar to $') goes into result, but this should always be empty
$result .= _RunBlockGamut(substr($list_str, pos($list_str)));
$g_list_level--;
return ($result, $first_marker, $fancy);

Loading…
Cancel
Save