Index: branches/REL1_16/phase3/includes/Article.php |
— | — | @@ -799,15 +799,6 @@ |
800 | 800 | wfIncrStats( 'pcache_miss_stub' ); |
801 | 801 | } |
802 | 802 | |
803 | | - # For the main page, overwrite the <title> element with the con- |
804 | | - # tents of 'pagetitle-view-mainpage' instead of the default (if |
805 | | - # that's not empty). |
806 | | - if ( $this->mTitle->equals( Title::newMainPage() ) |
807 | | - && ( $m = wfMsgForContent( 'pagetitle-view-mainpage' ) ) !== '' ) |
808 | | - { |
809 | | - $wgOut->setHTMLTitle( $m ); |
810 | | - } |
811 | | - |
812 | 803 | $wasRedirected = $this->showRedirectedFromHeader(); |
813 | 804 | $this->showNamespaceHeader(); |
814 | 805 | |
— | — | @@ -815,6 +806,7 @@ |
816 | 807 | # Keep going until $outputDone is set, or we run out of things to do. |
817 | 808 | $pass = 0; |
818 | 809 | $outputDone = false; |
| 810 | + $this->mParserOutput = false; |
819 | 811 | while ( !$outputDone && ++$pass ) { |
820 | 812 | switch( $pass ) { |
821 | 813 | case 1: |
— | — | @@ -923,6 +915,23 @@ |
924 | 916 | } |
925 | 917 | } |
926 | 918 | |
| 919 | + # Adjust the title if it was set by displaytitle, -{T|}- or language conversion |
| 920 | + if ( $this->mParserOutput ) { |
| 921 | + $titleText = $this->mParserOutput->getTitleText(); |
| 922 | + if ( strval( $titleText ) !== '' ) { |
| 923 | + $wgOut->setPageTitle( $titleText ); |
| 924 | + } |
| 925 | + } |
| 926 | + |
| 927 | + # For the main page, overwrite the <title> element with the con- |
| 928 | + # tents of 'pagetitle-view-mainpage' instead of the default (if |
| 929 | + # that's not empty). |
| 930 | + if ( $this->mTitle->equals( Title::newMainPage() ) |
| 931 | + && ( $m = wfMsgForContent( 'pagetitle-view-mainpage' ) ) !== '' ) |
| 932 | + { |
| 933 | + $wgOut->setHTMLTitle( $m ); |
| 934 | + } |
| 935 | + |
927 | 936 | # Now that we've filled $this->mParserOutput, we know whether |
928 | 937 | # there are any __NOINDEX__ tags on the page |
929 | 938 | $policy = $this->getRobotPolicy( 'view' ); |
Property changes on: branches/REL1_16/phase3/includes/Article.php |
___________________________________________________________________ |
Added: svn:mergeinfo |
930 | 939 | Merged /branches/sqlite/includes/Article.php:r58211-58321 |
931 | 940 | Merged /trunk/phase3/includes/Article.php:r63549,63764,63897-63901,64918,64934 |
932 | 941 | Merged /branches/wmf-deployment/includes/Article.php:r53381 |
933 | 942 | Merged /branches/REL1_15/phase3/includes/Article.php:r51646 |
Index: branches/REL1_16/phase3/includes/parser/Parser.php |
— | — | @@ -305,7 +305,7 @@ |
306 | 306 | * to internalParse() which does all the real work. |
307 | 307 | */ |
308 | 308 | |
309 | | - global $wgUseTidy, $wgAlwaysUseTidy, $wgContLang, $wgDisableLangConversion, $wgUser, $wgRequest, $wgDisableTitleConversion; |
| 309 | + global $wgUseTidy, $wgAlwaysUseTidy, $wgContLang, $wgDisableLangConversion, $wgDisableTitleConversion; |
310 | 310 | $fname = __METHOD__.'-' . wfGetCaller(); |
311 | 311 | wfProfileIn( __METHOD__ ); |
312 | 312 | wfProfileIn( $fname ); |
— | — | @@ -379,16 +379,16 @@ |
380 | 380 | */ |
381 | 381 | if ( !( $wgDisableLangConversion |
382 | 382 | || $wgDisableTitleConversion |
383 | | - || $wgRequest->getText( 'redirect', 'yes' ) == 'no' |
384 | | - || $wgRequest->getText( 'linkconvert', 'yes' ) == 'no' |
385 | 383 | || isset( $this->mDoubleUnderscores['nocontentconvert'] ) |
386 | 384 | || isset( $this->mDoubleUnderscores['notitleconvert'] ) |
387 | | - || $wgUser->getOption( 'noconvertlink' ) == 1 ) ) { |
| 385 | + || $this->mOutput->getDisplayTitle() !== false ) ) |
| 386 | + { |
388 | 387 | $convruletitle = $wgContLang->getConvRuleTitle(); |
389 | 388 | if ( $convruletitle ) { |
390 | 389 | $this->mOutput->setTitleText( $convruletitle ); |
391 | 390 | } else { |
392 | | - $this->mOutput->setTitleText( $wgContLang->convert( $title->getPrefixedText(), true ) ); |
| 391 | + $titleText = $wgContLang->convertTitle( $title ); |
| 392 | + $this->mOutput->setTitleText( $titleText ); |
393 | 393 | } |
394 | 394 | } |
395 | 395 | |
Index: branches/REL1_16/phase3/includes/OutputPage.php |
— | — | @@ -477,7 +477,7 @@ |
478 | 478 | } |
479 | 479 | |
480 | 480 | # change "<i>foo&bar</i>" to "foo&bar" |
481 | | - $this->setHTMLTitle( wfMsg( 'pagetitle', Sanitizer::stripAllTags( $nameWithTags ) ), true ); |
| 481 | + $this->setHTMLTitle( wfMsg( 'pagetitle', Sanitizer::stripAllTags( $nameWithTags ) ) ); |
482 | 482 | } |
483 | 483 | |
484 | 484 | /** |
Property changes on: branches/REL1_16/phase3/includes/OutputPage.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
485 | 485 | Merged /trunk/phase3/includes/OutputPage.php:r64892,64918 |
Property changes on: branches/REL1_16/phase3/includes |
___________________________________________________________________ |
Modified: svn:mergeinfo |
486 | 486 | Merged /trunk/phase3/includes:r64876 |
Index: branches/REL1_16/phase3/languages/LanguageConverter.php |
— | — | @@ -520,24 +520,6 @@ |
521 | 521 | } |
522 | 522 | |
523 | 523 | /** |
524 | | - * Convert namespace. |
525 | | - * @param $title String: the title included namespace |
526 | | - * @return Array of string |
527 | | - * @private |
528 | | - */ |
529 | | - function convertNamespace( $title, $variant ) { |
530 | | - $splittitle = explode( ':', $title, 2 ); |
531 | | - if ( count( $splittitle ) < 2 ) { |
532 | | - return $title; |
533 | | - } |
534 | | - if ( isset( $this->mNamespaceTables[$variant][$splittitle[0]] ) ) { |
535 | | - $splittitle[0] = $this->mNamespaceTables[$variant][$splittitle[0]]; |
536 | | - } |
537 | | - $ret = implode( ':', $splittitle ); |
538 | | - return $ret; |
539 | | - } |
540 | | - |
541 | | - /** |
542 | 524 | * Convert text to different variants of a language. The automatic |
543 | 525 | * conversion is done in autoConvert(). Here we parse the text |
544 | 526 | * marked with -{}-, which specifies special conversions of the |
— | — | @@ -551,19 +533,34 @@ |
552 | 534 | * @param $text String: text to be converted |
553 | 535 | * @return String: converted text |
554 | 536 | */ |
555 | | - public function convert( $text, $istitle = false ) { |
| 537 | + public function convert( $text ) { |
556 | 538 | global $wgDisableLangConversion; |
557 | 539 | if ( $wgDisableLangConversion ) return $text; |
558 | 540 | |
559 | 541 | $variant = $this->getPreferredVariant(); |
560 | 542 | |
561 | | - if( $istitle ) { |
562 | | - $text = $this->convertNamespace( $text, $variant ); |
563 | | - } |
564 | | - |
565 | 543 | return $this->recursiveConvertTopLevel( $text, $variant ); |
566 | 544 | } |
567 | 545 | |
| 546 | + /** |
| 547 | + * Convert a Title object to a readable string in the preferred variant |
| 548 | + */ |
| 549 | + public function convertTitle( $title ) { |
| 550 | + $variant = $this->getPreferredVariant(); |
| 551 | + if ( $title->getNamespace() === NS_MAIN ) { |
| 552 | + $text = ''; |
| 553 | + } else { |
| 554 | + $text = $title->getNsText(); |
| 555 | + if ( isset( $this->mNamespaceTables[$variant][$text] ) ) { |
| 556 | + $text = $this->mNamespaceTables[$variant][$text]; |
| 557 | + } |
| 558 | + $text .= ':'; |
| 559 | + } |
| 560 | + $text .= $title->getText(); |
| 561 | + $text = $this->autoConvert( $text, $variant ); |
| 562 | + return $text; |
| 563 | + } |
| 564 | + |
568 | 565 | protected function recursiveConvertTopLevel( $text, $variant, $depth = 0 ) { |
569 | 566 | $startPos = 0; |
570 | 567 | $out = ''; |
Index: branches/REL1_16/phase3/languages/Language.php |
— | — | @@ -34,9 +34,10 @@ |
35 | 35 | */ |
36 | 36 | class FakeConverter { |
37 | 37 | var $mLang; |
38 | | - function FakeConverter($langobj) {$this->mLang = $langobj;} |
39 | | - function autoConvertToAllVariants($text) {return $text;} |
40 | | - function convert($t, $i) {return $t;} |
| 38 | + function FakeConverter( $langobj ) { $this->mLang = $langobj; } |
| 39 | + function autoConvertToAllVariants( $text ) { return $text; } |
| 40 | + function convert( $t ) { return $t; } |
| 41 | + function convertTitle( $t ) { return $t->getPrefixedText(); } |
41 | 42 | function getVariants() { return array( $this->mLang->getCode() ); } |
42 | 43 | function getPreferredVariant() { return $this->mLang->getCode(); } |
43 | 44 | function getConvRuleTitle() { return false; } |
— | — | @@ -2319,10 +2320,15 @@ |
2320 | 2321 | } |
2321 | 2322 | |
2322 | 2323 | # convert text to different variants of a language. |
2323 | | - function convert( $text, $isTitle = false) { |
2324 | | - return $this->mConverter->convert($text, $isTitle); |
| 2324 | + function convert( $text ) { |
| 2325 | + return $this->mConverter->convert( $text ); |
2325 | 2326 | } |
2326 | 2327 | |
| 2328 | + # Convert a Title object to a string in the preferred variant |
| 2329 | + function convertTitle( $title ) { |
| 2330 | + return $this->mConverter->convertTitle( $title ); |
| 2331 | + } |
| 2332 | + |
2327 | 2333 | # Check if this is a language with variants |
2328 | 2334 | function hasVariants(){ |
2329 | 2335 | return sizeof($this->getVariants())>1; |
Index: branches/REL1_16/phase3/RELEASE-NOTES |
— | — | @@ -51,6 +51,8 @@ |
52 | 52 | * Fixed a bug in the Vector skin where personal tools display behind the logo |
53 | 53 | * (bug 23139) Fixed a bug in edit conflict resolution, where both textboxes |
54 | 54 | showed the same text. |
| 55 | +* (bug 23115, bug 23124) Fixed various problems with <title> and <h1> elements |
| 56 | + in page views and previews when the language converter is enabled. |
55 | 57 | |
56 | 58 | === Changes since 1.16 beta 1 === |
57 | 59 | |
Property changes on: branches/REL1_16/phase3 |
___________________________________________________________________ |
Modified: svn:mergeinfo |
58 | 60 | Merged /trunk/phase3:r64876 |