*** Markdown.pm Fri Jan 11 22:36:12 2008 --- Markdown.pm Sat Jan 26 01:49:42 2008 *************** *** 635,648 **** # 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:.+?) --- 635,646 ---- # Re-usable patterns to match list item bullets and number markers: my $marker_ul = qr/[*+-]/; my $marker_ol = qr/\d+[.]/; ! my $ul_list = qr{ ( # $1 = whole list ( # $2 [ ]{0,$less_than_tab} ! (${marker_ul}) # $3 = first list item marker [ \t]+ ) (?s:.+?) *************** *** 653,659 **** (?=\S) (?! # Negative lookahead for another list item marker [ \t]* ! ${marker_any}[ \t]+ ) ) ) --- 651,677 ---- (?=\S) (?! # Negative lookahead for another list item marker [ \t]* ! ${marker_ul}[ \t]+ ! ) ! ) ! ) ! }mx; ! my $ol_list = qr{ ! ( # $1 = whole list ! ( # $2 ! [ ]{0,$less_than_tab} ! (${marker_ol}) # $3 = first list item marker ! [ \t]+ ! ) ! (?s:.+?) ! ( # $4 ! \z ! | ! \n{2,} ! (?=\S) ! (?! # Negative lookahead for another list item marker ! [ \t]* ! ${marker_ol}[ \t]+ ) ) ) *************** *** 680,709 **** if ($g_list_level) { $text =~ s{ ^ ! $whole_list }{ my $list = $1; - my $list_type = ($3 =~ m/$marker_ul/) ? "ul" : "ol"; # 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 }{ my $list = $1; - my $list_type = ($3 =~ m/$marker_ul/) ? "ul" : "ol"; # 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; } --- 698,751 ---- if ($g_list_level) { $text =~ s{ ^ ! $ul_list }{ my $list = $1; # 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_ul); ! $result = "\n"; ! $result; ! }egmx; ! $text =~ s{ ! ^ ! $ol_list ! }{ ! my $list = $1; ! # 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_ol); ! $result = "
    \n" . $result . "
\n"; $result; }egmx; } else { $text =~ s{ (?:(?<=\n\n)|\A\n?) ! $ul_list($ol_list)? ! }{ ! my $list = $1; ! my $rest = $5; ! # 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_ul); ! $result = "\n"; ! $result .= "\n$rest" if $rest; ! $result; ! }egmx; ! $text =~ s{ ! (?:(?<=\n\n)|\A\n?) ! $ol_list }{ my $list = $1; # 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_ol); ! $result = "
    \n" . $result . "
\n"; $result; }egmx; }