Index: trunk/phase3/tests/parser/parserTests.txt |
— | — | @@ -2197,6 +2197,34 @@ |
2198 | 2198 | </p> |
2199 | 2199 | !! end |
2200 | 2200 | |
| 2201 | +!! test |
| 2202 | +Plain link to URL with link text |
| 2203 | +!! input |
| 2204 | +[[http://www.example.com Link text]] |
| 2205 | +!! result |
| 2206 | +<p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>] |
| 2207 | +</p> |
| 2208 | +!! end |
| 2209 | + |
| 2210 | +!! test |
| 2211 | +Plain link to protocol-relative URL |
| 2212 | +!! input |
| 2213 | +[[//www.example.com]] |
| 2214 | +!! result |
| 2215 | +<p>[<a rel="nofollow" class="external autonumber" href="https://www.mediawiki.org//www.example.com">[1]</a>] |
| 2216 | +</p> |
| 2217 | +!! end |
| 2218 | + |
| 2219 | +!! test |
| 2220 | +Plain link to protocol-relative URL with link text |
| 2221 | +!! input |
| 2222 | +[[//www.example.com Link text]] |
| 2223 | +!! result |
| 2224 | +<p>[<a rel="nofollow" class="external text" href="https://www.mediawiki.org//www.example.com">Link text</a>] |
| 2225 | +</p> |
| 2226 | +!! end |
| 2227 | + |
| 2228 | + |
2201 | 2229 | # I'm fairly sure the expected result here is wrong. |
2202 | 2230 | # We want these to be URL links, not pseudo-pages with URLs for titles.... |
2203 | 2231 | # However the current output is also pretty screwy. |
Index: trunk/phase3/includes/parser/Parser.php |
— | — | @@ -1896,7 +1896,7 @@ |
1897 | 1897 | # Don't allow internal links to pages containing |
1898 | 1898 | # PROTO: where PROTO is a valid URL protocol; these |
1899 | 1899 | # should be external links. |
1900 | | - if ( preg_match( '/^\b(?:' . wfUrlProtocols() . ')/', $m[1] ) ) { |
| 1900 | + if ( preg_match( '/^(?:' . wfUrlProtocols() . ')/', $m[1] ) ) { |
1901 | 1901 | $s .= $prefix . '[[' . $line ; |
1902 | 1902 | wfProfileOut( __METHOD__."-misc" ); |
1903 | 1903 | continue; |