Index: trunk/phase3/includes/Parser.php |
— | — | @@ -1469,7 +1469,7 @@ |
1470 | 1470 | $wgLinkCache->addImageLinkObj( $nt ); |
1471 | 1471 | continue; |
1472 | 1472 | } elseif( $ns == NS_SPECIAL ) { |
1473 | | - $s .= $prefix . $this->armorLinks( $sk->makeKnownLinkObj( $nt, $text, '', $trail ) ); |
| 1473 | + $s .= $this->makeKnownLinkHolder( $nt, $text, '', $trail, $prefix ); |
1474 | 1474 | continue; |
1475 | 1475 | } elseif( $ns == NS_IMAGE ) { |
1476 | 1476 | $img = Image::newFromTitle( $nt ); |
— | — | @@ -1477,7 +1477,7 @@ |
1478 | 1478 | // Force a blue link if the file exists; may be a remote |
1479 | 1479 | // upload on the shared repository, and we want to see its |
1480 | 1480 | // auto-generated page. |
1481 | | - $s .= $prefix . $this->armorLinks( $sk->makeKnownLinkObj( $nt, $text, '', $trail ) ); |
| 1481 | + $s .= $this->makeKnownLinkHolder( $nt, $text, '', $trail, $prefix ); |
1482 | 1482 | continue; |
1483 | 1483 | } |
1484 | 1484 | } |
— | — | @@ -1520,6 +1520,27 @@ |
1521 | 1521 | } |
1522 | 1522 | |
1523 | 1523 | /** |
| 1524 | + * Render a forced-blue link inline; protect against double expansion of |
| 1525 | + * URLs if we're in a mode that prepends full URL prefixes to internal links. |
| 1526 | + * Since this little disaster has to split off the trail text to avoid |
| 1527 | + * breaking URLs in the following text without breaking trails on the |
| 1528 | + * wiki links, it's been made into a horrible function. |
| 1529 | + * |
| 1530 | + * @param Title $nt |
| 1531 | + * @param string $text |
| 1532 | + * @param string $query |
| 1533 | + * @param string $trail |
| 1534 | + * @param string $prefix |
| 1535 | + * @return string HTML-wikitext mix oh yuck |
| 1536 | + */ |
| 1537 | + function makeKnownLinkHolder( $nt, $text = '', $query = '', $trail = '', $prefix = '' ) { |
| 1538 | + list( $inside, $trail ) = Linker::splitTrail( $trail ); |
| 1539 | + $sk =& $this->mOptions->getSkin(); |
| 1540 | + $link = $sk->makeKnownLinkObj( $nt, $text, $query, $inside, $prefix ); |
| 1541 | + return $this->armorLinks( $link ) . $trail; |
| 1542 | + } |
| 1543 | + |
| 1544 | + /** |
1524 | 1545 | * Insert a NOPARSE hacky thing into any inline links in a chunk that's |
1525 | 1546 | * going to go through further parsing steps before inline URL expansion. |
1526 | 1547 | * |