Index: trunk/phase3/languages/LanguageConverter.php |
— | — | @@ -42,6 +42,7 @@ |
43 | 43 | * @param array $variantfallback the fallback language of each variant |
44 | 44 | * @param array $markup array defining the markup used for manual conversion |
45 | 45 | * @param array $flags array defining the custom strings that maps to the flags |
| 46 | + * @param array $manualLevel limit for supported variants |
46 | 47 | * @public |
47 | 48 | */ |
48 | 49 | function __construct($langobj, $maincode, |
— | — | @@ -323,15 +324,14 @@ |
324 | 325 | $this->mTitleDisplay = $title; |
325 | 326 | } |
326 | 327 | |
327 | | - //add manual conversion table to global table |
| 328 | + //apply manual conversion table to global table |
328 | 329 | $convTable = $convRule->getConvTable(); |
329 | | - $isAdd = $convRule->getRulesAction()=="add"; |
330 | | - $isRemove = $convRule->getRulesAction()=="remove"; |
| 330 | + $action = $convRule->getRulesAction(); |
331 | 331 | foreach($convTable as $v=>$t) { |
332 | 332 | if( !in_array($v,$this->mVariants) )continue; |
333 | | - if( $isAdd ) |
| 333 | + if( $action=="add" ) |
334 | 334 | $this->mTables[$v]->mergeArray($t); |
335 | | - elseif ( $isRemove ) |
| 335 | + elseif ( $action=="remove" ) |
336 | 336 | $this->mTables[$v]->removeArray($t); |
337 | 337 | } |
338 | 338 | } |
— | — | @@ -841,14 +841,6 @@ |
842 | 842 | $rules = $text; |
843 | 843 | } |
844 | 844 | |
845 | | - if( !in_array('R',$flags) ){ |
846 | | - //FIXME: may cause trouble here... |
847 | | - //strip since it interferes with the parsing, plus, |
848 | | - //all spaces should be stripped in this tag anyway. |
849 | | - $rules = str_replace(' ', '', $rules); |
850 | | - $rules = str_replace('=>','=>',$rules); |
851 | | - } |
852 | | - |
853 | 845 | //check flags |
854 | 846 | if( in_array('R',$flags) ){ |
855 | 847 | $flags = array('R');// remove other flags |
— | — | @@ -976,7 +968,6 @@ |
977 | 969 | * @private |
978 | 970 | */ |
979 | 971 | function generateConvTable(){ |
980 | | - //$rules = $this->mRules; |
981 | 972 | $flags = $this->mFlags; |
982 | 973 | $bidtable = $this->mBidtable; |
983 | 974 | $unidtable = $this->mUnidtable; |
— | — | @@ -1027,10 +1018,19 @@ |
1028 | 1019 | if(!$variant) $variant = $this->mConverter->getPreferredVariant(); |
1029 | 1020 | |
1030 | 1021 | $this->parseFlags(); |
1031 | | - $this->parseRules(); |
| 1022 | + $flags = $this->mFlags; |
1032 | 1023 | |
| 1024 | + if( !in_array('R',$flags) || !in_array('N',$flags) ){ |
| 1025 | + //FIXME: may cause trouble here... |
| 1026 | + //strip since it interferes with the parsing, plus, |
| 1027 | + //all spaces should be stripped in this tag anyway. |
| 1028 | + $this->mRules = str_replace(' ', '', $this->mRules); |
| 1029 | + // decode => HTML entities modified by Sanitizer::removeHTMLtags |
| 1030 | + $this->mRules = str_replace('=>','=>',$this->mRules); |
| 1031 | + |
| 1032 | + $this->parseRules(); |
| 1033 | + } |
1033 | 1034 | $rules = $this->mRules; |
1034 | | - $flags = $this->mFlags; |
1035 | 1035 | |
1036 | 1036 | if(count($this->mBidtable)==0 && count($this->mUnidtable)==0){ |
1037 | 1037 | if(in_array('+',$flags) || in_array('-',$flags)) |
— | — | @@ -1059,7 +1059,7 @@ |
1060 | 1060 | } else { |
1061 | 1061 | $this->mRuleDisplay= $this->mManualCodeError; |
1062 | 1062 | } |
1063 | | - // proces T flag : output nothing |
| 1063 | + // proces T flag |
1064 | 1064 | if ( in_array('T',$flags) ) { |
1065 | 1065 | $this->mRuleTitle = $this->getRuleConvertedStr($variant, |
1066 | 1066 | $this->mConverter->mDoTitleConvert); |
— | — | @@ -1082,7 +1082,6 @@ |
1083 | 1083 | |
1084 | 1084 | /** |
1085 | 1085 | * get display text on markup -{...}- |
1086 | | - * @param string $variant the current variant |
1087 | 1086 | * @public |
1088 | 1087 | */ |
1089 | 1088 | function getDisplay(){ |
— | — | @@ -1090,7 +1089,6 @@ |
1091 | 1090 | } |
1092 | 1091 | /** |
1093 | 1092 | * get converted title |
1094 | | - * @param string $variant the current variant |
1095 | 1093 | * @public |
1096 | 1094 | */ |
1097 | 1095 | function getTitle(){ |