Merge "Fix Title::loadRestrictions() for create-protected titles"
[lhc/web/wiklou.git] / languages / LanguageConverter.php
index 1c003ad..361a9a7 100644 (file)
@@ -48,7 +48,9 @@ class LanguageConverter {
        ];
 
        public $mMainLanguageCode;
-       public $mVariants, $mVariantFallbacks, $mVariantNames;
+       public $mVariants;
+       public $mVariantFallbacks;
+       public $mVariantNames;
        public $mTablesLoaded = false;
        public $mTables;
        // 'bidirectional' 'unidirectional' 'disable' for each variant
@@ -97,13 +99,13 @@ class LanguageConverter {
                        // '+' add rules for alltext
                        // 'E' the gave flags is error
                        // these flags above are reserved for program
-                       'A' => 'A',       // add rule for convert code (all text convert)
-                       'T' => 'T',       // title convert
-                       'R' => 'R',       // raw content
-                       'D' => 'D',       // convert description (subclass implement)
-                       '-' => '-',       // remove convert (not implement)
-                       'H' => 'H',       // add rule for convert code (but no display in placed code)
-                       'N' => 'N'        // current variant name
+                       'A' => 'A',   // add rule for convert code (all text convert)
+                       'T' => 'T',   // title convert
+                       'R' => 'R',   // raw content
+                       'D' => 'D',   // convert description (subclass implement)
+                       '-' => '-',   // remove convert (not implement)
+                       'H' => 'H',   // add rule for convert code (but no display in placed code)
+                       'N' => 'N',   // current variant name
                ];
                $this->mFlags = array_merge( $defaultflags, $flags );
                foreach ( $this->mVariants as $v ) {
@@ -355,10 +357,10 @@ class LanguageConverter {
                }
 
                /* we convert everything except:
-                  1. HTML markups (anything between < and >)
-                  2. HTML entities
-                  3. placeholders created by the parser
-               */
+                * 1. HTML markups (anything between < and >)
+                * 2. HTML entities
+                * 3. placeholders created by the parser
+                */
                $marker = '|' . Parser::MARKER_PREFIX . '[\-a-zA-Z0-9]+';
 
                // this one is needed when the text is inside an HTML markup
@@ -413,8 +415,6 @@ class LanguageConverter {
                                                $attr = $this->recursiveConvertTopLevel( $attr, $toVariant );
                                        }
 
-                                       // Remove HTML tags to avoid disrupting the layout
-                                       $attr = preg_replace( '/<[^>]+>/', '', $attr );
                                        if ( $attr !== $attrs[$attrName] ) {
                                                $attrs[$attrName] = $attr;
                                                $changed = true;
@@ -489,7 +489,7 @@ class LanguageConverter {
        protected function applyManualConv( $convRule ) {
                // Use syntax -{T|zh-cn:TitleCN; zh-tw:TitleTw}- to custom
                // title conversion.
-               // Bug 24072: $mConvRuleTitle was overwritten by other manual
+               // T26072: $mConvRuleTitle was overwritten by other manual
                // rule(s) not for title, this breaks the title conversion.
                $newConvRuleTitle = $convRule->getTitle();
                if ( $newConvRuleTitle ) {
@@ -1085,12 +1085,12 @@ class LanguageConverter {
                        // text should be splited by ";" only if a valid variant
                        // name exist after the markup, for example:
                        //  -{zh-hans:<span style="font-size:120%;">xxx</span>;zh-hant:\
-                       //      <span style="font-size:120%;">yyy</span>;}-
+                       //  <span style="font-size:120%;">yyy</span>;}-
                        // we should split it as:
                        //  [
-                       //        [0] => 'zh-hans:<span style="font-size:120%;">xxx</span>'
-                       //        [1] => 'zh-hant:<span style="font-size:120%;">yyy</span>'
-                       //        [2] => ''
+                       //    [0] => 'zh-hans:<span style="font-size:120%;">xxx</span>'
+                       //    [1] => 'zh-hant:<span style="font-size:120%;">yyy</span>'
+                       //    [2] => ''
                        //  ]
                        $pat = '/;\s*(?=';
                        foreach ( $this->mVariants as $variant ) {