r69080 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r69079‎ | r69080 | r69081 >
Date:03:06, 6 July 2010
Author:philip
Status:ok (Comments)
Tags:brion 
Comment:
Bug 24072: The manual conversion of title was taken interferes by other manual conversion rule(s). This patch fixed the problem and add a new test to parserTests.txt to prevent it to reappear again.
Modified paths:
  • /trunk/phase3/languages/LanguageConverter.php (modified) (history)
  • /trunk/phase3/maintenance/parserTests.txt (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/parserTests.txt
@@ -7243,6 +7243,20 @@
72447244 !! end
72457245
72467246 !! test
 7247+Bug 24072: more test on conversion rule for title
 7248+!! options
 7249+language=zh variant=zh-tw showtitle
 7250+!! input
 7251+This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
 7252+This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
 7253+!! result
 7254+Taiwan
 7255+<p>This should be stripped!
 7256+This won't take interferes with the title rule.
 7257+</p>
 7258+!! end
 7259+
 7260+!! test
72477261 Raw output of variant escape tags (R flag)
72487262 !! options
72497263 language=zh variant=zh-tw
Index: trunk/phase3/languages/LanguageConverter.php
@@ -488,9 +488,14 @@
489489 * @private
490490 */
491491 function applyManualConv( $convRule ) {
492 - // use syntax -{T|zh:TitleZh;zh-tw:TitleTw}- for custom
493 - // conversion in title
494 - $this->mConvRuleTitle = $convRule->getTitle();
 492+ // Use syntax -{T|zh-cn:TitleCN; zh-tw:TitleTw}- to custom
 493+ // title conversion.
 494+ // Bug 24072: mConvRuleTitle won't work if the title conversion
 495+ // rule was followed by other manual conversion rule(s).
 496+ $newConvRuleTitle = $convRule->getTitle();
 497+ if( $newConvRuleTitle ) {
 498+ $this->mConvRuleTitle = $newConvRuleTitle;
 499+ }
495500
496501 // apply manual conversion table to global table
497502 $convTable = $convRule->getConvTable();

Follow-up revisions

RevisionCommit summaryAuthorDate
r70187Merge r69080, r69081, r69085, r69086 from trunk: bug fixes of Language Conver...philip01:49, 30 July 2010

Comments

#Comment by Brion VIBBER (talk | contribs)   03:48, 8 February 2011

Looks good -- mConvRuleTitle (via getConvRuleTitle()) gets pulled from conversion by the wikitext parser for the page's title display (where not suppressed or overridden by something else like a DISPLAYTITLE or conversion suppression). Only title rules should actually set it then, which makes some nice logical sense. :D

Status & tagging log