Index: trunk/phase3/maintenance/parserTests.txt |
— | — | @@ -1462,12 +1462,10 @@ |
1463 | 1463 | |
1464 | 1464 | !! test |
1465 | 1465 | Link containing double-single-quotes '' (bug 4598) |
1466 | | -!! options |
1467 | | -disabled |
1468 | 1466 | !! input |
1469 | 1467 | [[Lista d''e paise d''o munno]] |
1470 | 1468 | !! result |
1471 | | -<p><a href="https://www.mediawiki.org/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&action=edit" class="new" title="Lista d''e paise d''o munno">Lista d''e paise d''o munno</a> |
| 1469 | +<p><a href="https://www.mediawiki.org/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&action=edit&redlink=1" class="new" title="Lista d''e paise d''o munno (page does not exist)">Lista d''e paise d''o munno</a> |
1472 | 1470 | </p> |
1473 | 1471 | !! end |
1474 | 1472 | |
— | — | @@ -1485,11 +1483,29 @@ |
1486 | 1484 | !! input |
1487 | 1485 | ''Some [[Link|pretty ''italics'' and stuff]]! |
1488 | 1486 | !! result |
1489 | | -<p><i>Some </i><a href="https://www.mediawiki.org/index.php?title=Link&action=edit&redlink=1" class="new" title="Link (page does not exist)"><i>pretty </i>italics<i> and stuff</i></a><i>!</i> |
| 1487 | +<p><i>Some <a href="https://www.mediawiki.org/index.php?title=Link&action=edit&redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!</i> |
1490 | 1488 | </p> |
1491 | 1489 | !! end |
1492 | 1490 | |
1493 | 1491 | !! test |
| 1492 | +Link with double quotes in title part (literal) and alternate part (interpreted) |
| 1493 | +!! input |
| 1494 | +[[File:Denys Savchenko ''Pentecoste''.jpg]] |
| 1495 | + |
| 1496 | +[[''Pentecoste'']] |
| 1497 | + |
| 1498 | +[[''Pentecoste''|Pentecoste]] |
| 1499 | + |
| 1500 | +[[''Pentecoste''|''Pentecoste'']] |
| 1501 | +!! result |
| 1502 | +<p><a href="https://www.mediawiki.org/index.php?title=Special:Upload&wpDestFile=Denys_Savchenko_%27%27Pentecoste%27%27.jpg" class="new" title="File:Denys Savchenko ''Pentecoste''.jpg">File:Denys Savchenko <i>Pentecoste</i>.jpg</a> |
| 1503 | +</p><p><a href="https://www.mediawiki.org/index.php?title=%27%27Pentecoste%27%27&action=edit&redlink=1" class="new" title="''Pentecoste'' (page does not exist)">''Pentecoste''</a> |
| 1504 | +</p><p><a href="https://www.mediawiki.org/index.php?title=%27%27Pentecoste%27%27&action=edit&redlink=1" class="new" title="''Pentecoste'' (page does not exist)">Pentecoste</a> |
| 1505 | +</p><p><a href="https://www.mediawiki.org/index.php?title=%27%27Pentecoste%27%27&action=edit&redlink=1" class="new" title="''Pentecoste'' (page does not exist)"><i>Pentecoste</i></a> |
| 1506 | +</p> |
| 1507 | +!! end |
| 1508 | + |
| 1509 | +!! test |
1494 | 1510 | Plain link to URL |
1495 | 1511 | !! input |
1496 | 1512 | [[http://www.example.com]] |
Index: trunk/phase3/includes/parser/Parser.php |
— | — | @@ -1072,9 +1072,9 @@ |
1073 | 1073 | $df = DateFormatter::getInstance(); |
1074 | 1074 | $text = $df->reformat( $this->mOptions->getDateFormat(), $text ); |
1075 | 1075 | } |
1076 | | - $text = $this->doAllQuotes( $text ); |
1077 | 1076 | $text = $this->replaceInternalLinks( $text ); |
1078 | 1077 | $text = $this->replaceExternalLinks( $text ); |
| 1078 | + $text = $this->doAllQuotes( $text ); |
1079 | 1079 | |
1080 | 1080 | # replaceInternalLinks may sometimes leave behind |
1081 | 1081 | # absolute URLs, which have to be masked to hide them from replaceExternalLinks |
— | — | @@ -1841,6 +1841,11 @@ |
1842 | 1842 | $wasblank = ( $text == '' ); |
1843 | 1843 | if ( $wasblank ) { |
1844 | 1844 | $text = $link; |
| 1845 | + } else { |
| 1846 | + # Bug 4598 madness. Handle the quotes only if they come from the alternate part |
| 1847 | + # [[Lista d''e paise d''o munno]] -> <a href="">Lista d''e paise d''o munno</a> |
| 1848 | + # [[Criticism of Harry Potter|Criticism of ''Harry Potter'']] -> <a href="Criticism of Harry Potter">Criticism of <i>Harry Potter</i></a> |
| 1849 | + $text = $this->doQuotes($text); |
1845 | 1850 | } |
1846 | 1851 | |
1847 | 1852 | # Link not escaped by : , create the various objects |
Index: trunk/phase3/includes/Linker.php |
— | — | @@ -693,11 +693,9 @@ |
694 | 694 | list( $inside, $trail ) = self::splitTrail( $trail ); |
695 | 695 | |
696 | 696 | wfProfileOut( __METHOD__ ); |
697 | | - return Html::element( 'a', array( |
698 | | - 'href' => $href, |
699 | | - 'class' => 'new', |
700 | | - 'title' => $title->getPrefixedText() |
701 | | - ), $prefix . $text . $inside ) . $trail; |
| 697 | + return '<a href="' . htmlspecialchars( $href ) . '" class="new" title="' . |
| 698 | + htmlspecialchars( $title->getPrefixedText(), ENT_QUOTES ) . '">' . |
| 699 | + htmlspecialchars( $prefix . $text . $inside, ENT_NOQUOTES ) . '</a>' . $trail; |
702 | 700 | } else { |
703 | 701 | wfProfileOut( __METHOD__ ); |
704 | 702 | return $this->makeKnownLinkObj( $title, $text, $query, $trail, $prefix ); |
— | — | @@ -751,7 +749,7 @@ |
752 | 750 | $url = $this->getUploadUrl( $title ); |
753 | 751 | $class = 'new'; |
754 | 752 | } |
755 | | - $alt = htmlspecialchars( $title->getText() ); |
| 753 | + $alt = htmlspecialchars( $title->getText(), ENT_QUOTES ); |
756 | 754 | if( $text == '' ) { |
757 | 755 | $text = $alt; |
758 | 756 | } |