From 2a2fa3c0ba41bb2fec37f2a972b30bf796fbf0b9 Mon Sep 17 00:00:00 2001 From: Alex Schroeder Date: Fri, 14 Oct 2005 21:12:55 +0000 Subject: [PATCH] (MarkupRule): Prevent forced markup from spanning empty lines when start and end tag are the same. This is specially tricky when // is used on a file path, for example. --- modules/markup.pl | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/modules/markup.pl b/modules/markup.pl index d3e7470e..e89c70fa 100644 --- a/modules/markup.pl +++ b/modules/markup.pl @@ -16,7 +16,7 @@ # 59 Temple Place, Suite 330 # Boston, MA 02111-1307 USA -$ModulesDescription .= '

$Id: markup.pl,v 1.23 2005/10/09 11:35:50 as Exp $

'; +$ModulesDescription .= '

$Id: markup.pl,v 1.24 2005/10/14 21:12:55 as Exp $

'; use vars qw(%MarkupPairs %MarkupSingles %MarkupLines); @@ -115,13 +115,15 @@ sub MarkupRule { my @data = @{$data}; $end = $data[2] if $data[2]; } - $end = quotemeta($end); - if ($end and m/\G((:?.|\n)*?)$end/gc) { - if ($1) { - return MarkupTag($data, $1); - } else { - return $tag . $end; - } + my $endre = quotemeta($end); + # may match the empty string, or multiple lines, but may not span + # paragraphs. + if ($endre and m/\G$endre/gc) { + return $tag . $end; + } elsif ($tag eq $end && m/\G((:?.+?\n)*?.+?)$endre/gc) { # may not span paragraphs + return MarkupTag($data, $1); + } elsif ($tag ne $end && m/\G((:?.|\n)+?)$endre/gc) { + return MarkupTag($data, $1); } else { return $tag; }