From d045206593953ebfeb22858baa25e8c2fe565e33 Mon Sep 17 00:00:00 2001 From: Gervase Markham Date: Sun, 26 Feb 2017 02:54:49 +0000 Subject: Bug 1174341 - only treat emphasis markdown based on spaces --- Bugzilla/Markdown.pm | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'Bugzilla') diff --git a/Bugzilla/Markdown.pm b/Bugzilla/Markdown.pm index 72e788fd0..b7d7b4393 100644 --- a/Bugzilla/Markdown.pm +++ b/Bugzilla/Markdown.pm @@ -350,38 +350,38 @@ sub _DoItalicsAndBold { $text =~ s{ ^\* (?=\S) (.+?) (?<=\S) \* }{$1}gsx; # must go first: - $text =~ s{ ( (?<=\W) __ (?=\S) (.+?[*_]*) (?<=\S) __ (?!\S) ) } + $text =~ s{ ( (?<=\s) __ (?=\S) (.+?[*_]*) (?<=\S) __ (?!\S) ) } { my $result = _has_multiple_underscores($2) ? $1 : "$2"; $result; }gsxe; - $text =~ s{ (?<=\W) \*\* (?=\S) (.+?[*_]*) (?<=\S) \*\* }{$1}gsx; + $text =~ s{ (?<=\s) \*\* (?=\S) (.+?[*_]*) (?<=\S) \*\* }{$1}gsx; - $text =~ s{ ( (?<=\W) _ (?=\S) (.+?) (?<=\S) _ (?!\S) ) } + $text =~ s{ ( (?<=\s) _ (?=\S) (.+?) (?<=\S) _ (?!\S) ) } { my $result = _has_multiple_underscores($2) ? $1 : "$2"; $result; }gsxe; - $text =~ s{ (?<=\W) \* (?=\S) (.+?) (?<=\S) \* }{$1}gsx; + $text =~ s{ (?<=\s) \* (?=\S) (.+?) (?<=\S) \* }{$1}gsx; # And now, a second pass to catch nested strong and emphasis special cases - $text =~ s{ ( (?<=\W) __ (?=\S) (.+?[*_]*) (?<=\S) __ (\S*) ) } + $text =~ s{ ( (?<=\s) __ (?=\S) (.+?[*_]*) (?<=\S) __ (\S*) ) } { my $result = _has_multiple_underscores($3) ? $1 : "$2$3"; $result; }gsxe; - $text =~ s{ (?<=\W) \*\* (?=\S) (.+?[*_]*) (?<=\S) \*\* }{$1}gsx; - $text =~ s{ ( (?<=\W) _ (?=\S) (.+?) (?<=\S) _ (\S*) ) } + $text =~ s{ (?<=\s) \*\* (?=\S) (.+?[*_]*) (?<=\S) \*\* }{$1}gsx; + $text =~ s{ ( (?<=\s) _ (?=\S) (.+?) (?<=\S) _ (\S*) ) } { my $result = _has_multiple_underscores($3) ? $1 : "$2$3"; $result; }gsxe; - $text =~ s{ (?<=\W) \* (?=\S) (.+?) (?<=\S) \* }{$1}gsx; + $text =~ s{ (?<=\s) \* (?=\S) (.+?) (?<=\S) \* }{$1}gsx; return $text; } -- cgit v1.2.3-24-g4f1b