problems. If errors are transitory, this should reduce annoying messages
making it into cached display.
* (bug 6103) Wrap self-links in a CSS class ("selflink")
+* (bug 6102) For consistency with other markup, normalize all HTML-encoded
+ character entities in URLs, not just ampersands. This allows use of eg
+ = when making URLs for template parameters.
+
== Compatibility ==
$text = $wgContLang->markNoConversion($text);
- # Replace & from obsolete syntax with &.
- # All HTML entities will be escaped by makeExternalLink()
- $url = str_replace( '&', '&', $url );
+ # Normalize any HTML entities in input. They will be
+ # re-escaped by makeExternalLink().
+ $url = Sanitizer::decodeCharReferences( $url );
# Process the trail (i.e. everything after this link up until start of the next link),
# replacing any non-bracketed links
$url = substr( $url, 0, -$numSepChars );
}
- # Replace & from obsolete syntax with &.
- # All HTML entities will be escaped by makeExternalLink()
- # or maybeMakeExternalImage()
- $url = str_replace( '&', '&', $url );
+ # Normalize any HTML entities in input. They will be
+ # re-escaped by makeExternalLink() or maybeMakeExternalImage()
+ $url = Sanitizer::decodeCharReferences( $url );
# Is this an external image?
$text = $this->maybeMakeExternalImage( $url );
</p>
!! end
+!! test
+External links: encoded equals (bug 6102)
+!! input
+http://example.com/?foo=bar
+!! result
+<p><a href="http://example.com/?foo=bar" class='external free' title="http://example.com/?foo=bar" rel="nofollow">http://example.com/?foo=bar</a>
+</p>
+!! end
+
!! test
External links: [raw ampersand]
!! input
</p>
!! end
+!! test
+External links: [encoded equals] (bug 6102)
+!! input
+[http://example.com/?foo=bar]
+!! result
+<p><a href="http://example.com/?foo=bar" class='external autonumber' title="http://example.com/?foo=bar" rel="nofollow">[1]</a>
+</p>
+!! end
+
!! test
External links: www.jpeg.org (bug 554)
!! input