Bug 1061226: markdown isn't linkifying urls

r=dkl,a=glob


git-svn-id: svn://10.0.0.236/trunk@265897 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bzrmirror%bugzilla.org 2015-04-02 14:45:56 +00:00
parent 48c31310f3
commit 66c9d06ac7
3 changed files with 19 additions and 3 deletions

View File

@ -1 +1 @@
9351 9352

View File

@ -1 +1 @@
1fbcede24288ad8abdeaf49255e5c0996ac2df4c 1fa1aa54ae725989c6c44f198376e37ba000ca02

View File

@ -237,7 +237,7 @@ sub _DoAnchors {
}xsge; }xsge;
# #
# Last, handle reference-style shortcuts: [link text] # Handle reference-style shortcuts: [link text]
# These must come last in case you've also got [link test][1] # These must come last in case you've also got [link test][1]
# or [link test](/foo) # or [link test](/foo)
# #
@ -256,6 +256,22 @@ sub _DoAnchors {
$self->_GenerateAnchor($whole_match, $link_text, $link_id); $self->_GenerateAnchor($whole_match, $link_text, $link_id);
}xsge; }xsge;
# Last, handle "naked" references
# Caveat, does not handle ;http://amazon.com
my $safe_url_regexp = Bugzilla::Template::SAFE_URL_REGEXP();
$text =~ s{
(
(^|(?<![;^"'<>])) # negative lookbehind, including ';' in '&lt;'
( # wrap url in $3
(?:https?|ftp):[^'">\s]+\w
)
)
}{
my $whole_match = $3;
my $url = $whole_match;
$self->_GenerateAnchor($whole_match, $url, undef, $url, undef);
}xsge;
return $text; return $text;
} }