*** Markdown.pm Fri Jan 11 22:36:12 2008 --- Markdown.pm Fri Jan 25 18:20:14 2008 *************** *** 635,663 **** # Re-usable patterns to match list item bullets and number markers: my $marker_ul = qr/[*+-]/; my $marker_ol = qr/\d+[.]/; - my $marker_any = qr/(?:$marker_ul|$marker_ol)/; # Re-usable pattern to match any entirel ul or ol list: ! my $whole_list = qr{ ! ( # $1 = whole list ! ( # $2 ! [ ]{0,$less_than_tab} ! (${marker_any}) # $3 = first list item marker ! [ \t]+ ! ) ! (?s:.+?) ! ( # $4 ! \z ! | ! \n{2,} ! (?=\S) ! (?! # Negative lookahead for another list item marker ! [ \t]* ! ${marker_any}[ \t]+ ) ! ) ! ) ! }mx; # We use a different prefix before nested lists than top-level lists. # See extended comment in _ProcessListItems(). --- 635,665 ---- # Re-usable patterns to match list item bullets and number markers: my $marker_ul = qr/[*+-]/; my $marker_ol = qr/\d+[.]/; # Re-usable pattern to match any entirel ul or ol list: ! my @whole_list = map { ! my $marker = $_; ! qr{ ! ( # $1 = whole list ! ( # $2 ! [ ]{0,$less_than_tab} ! (${marker}) # $3 = first list item marker ! [ \t]+ ) ! (?s:.+?) ! ( # $4 ! \z ! | ! \n{2,} ! (?=\S) ! (?! # Negative lookahead for another list item marker ! [ \t]* ! ${marker}[ \t]+ ! ) ! ) ! ) ! }mx; ! } ($marker_ul, $marker_ol); # We use a different prefix before nested lists than top-level lists. # See extended comment in _ProcessListItems(). *************** *** 678,684 **** # static s/// patterns rather than one conditional pattern. if ($g_list_level) { ! $text =~ s{ ^ $whole_list }{ --- 680,687 ---- # static s/// patterns rather than one conditional pattern. if ($g_list_level) { ! for my $whole_list (@whole_list) { ! $text =~ s{ ^ $whole_list }{ *************** *** 687,699 **** # Turn double returns into triple returns, so that we can make a # paragraph for the last item in a list, if necessary: $list =~ s/\n{2,}/\n\n\n/g; ! my $result = _ProcessListItems($list, $marker_any); $result = "<$list_type>\n" . $result . "\n"; $result; }egmx; } else { ! $text =~ s{ (?:(?<=\n\n)|\A\n?) $whole_list }{ --- 690,706 ---- # Turn double returns into triple returns, so that we can make a # paragraph for the last item in a list, if necessary: $list =~ s/\n{2,}/\n\n\n/g; ! my $result = ( $list_type eq 'ul' ) ? ! _ProcessListItems($list, $marker_ul) ! : _ProcessListItems($list, $marker_ol); $result = "<$list_type>\n" . $result . "\n"; $result; }egmx; + } } else { ! for my $whole_list (@whole_list) { ! $text =~ s{ (?:(?<=\n\n)|\A\n?) $whole_list }{ *************** *** 702,711 **** # Turn double returns into triple returns, so that we can make a # paragraph for the last item in a list, if necessary: $list =~ s/\n{2,}/\n\n\n/g; ! my $result = _ProcessListItems($list, $marker_any); $result = "<$list_type>\n" . $result . "\n"; $result; }egmx; } --- 709,721 ---- # Turn double returns into triple returns, so that we can make a # paragraph for the last item in a list, if necessary: $list =~ s/\n{2,}/\n\n\n/g; ! my $result = ( $list_type eq 'ul' ) ? ! _ProcessListItems($list, $marker_ul) ! : _ProcessListItems($list, $marker_ol); $result = "<$list_type>\n" . $result . "\n"; $result; }egmx; + } }