Index: trunk/phase3/languages/LanguageConverter.php |
— | — | @@ -998,23 +998,30 @@ |
999 | 999 | $bidtable = array(); |
1000 | 1000 | $unidtable = array(); |
1001 | 1001 | $markup = $this->mConverter->mMarkup; |
| 1002 | + $variants = $this->mConverter->mVariants; |
1002 | 1003 | |
1003 | | - $choice = explode($markup['varsep'], $rules); |
1004 | | - foreach($choice as $c) { |
| 1004 | + $varsep_pattern = '/' . $markup['varsep'] . '\s*' . '(?='; |
| 1005 | + foreach( $variants as $variant ) |
| 1006 | + $varsep_pattern .= $variant . '\s*' . $markup['codesep'] . '|'; |
| 1007 | + $varsep_pattern .= '\s*$)/'; |
| 1008 | + |
| 1009 | + $choice = preg_split($varsep_pattern, $rules); |
| 1010 | + foreach( $choice as $c ) { |
1005 | 1011 | $v = explode($markup['codesep'], $c, 2); |
1006 | 1012 | if( count($v) != 2 ) |
1007 | 1013 | continue;// syntax error, skip |
1008 | 1014 | $to = trim($v[1]); |
1009 | 1015 | $v = trim($v[0]); |
1010 | 1016 | $u = explode($markup['unidsep'], $v); |
1011 | | - if( count($u) == 1 ) { |
| 1017 | + if( count($u) == 1 && $to && in_array( $v, $variants ) ) { |
1012 | 1018 | $bidtable[$v] = $to; |
1013 | 1019 | } else if(count($u) == 2){ |
1014 | 1020 | $from = trim($u[0]); |
1015 | 1021 | $v = trim($u[1]); |
1016 | | - if( array_key_exists( $v, $unidtable ) && !is_array( $unidtable[$v] ) ) |
| 1022 | + if( array_key_exists( $v, $unidtable ) && !is_array( $unidtable[$v] ) |
| 1023 | + && $to && in_array( $v, $variants ) ) |
1017 | 1024 | $unidtable[$v] = array( $from=>$to ); |
1018 | | - else |
| 1025 | + elseif ( $to && in_array( $v, $variants ) ) |
1019 | 1026 | $unidtable[$v][$from] = $to; |
1020 | 1027 | } |
1021 | 1028 | // syntax error, pass |
— | — | @@ -1158,10 +1165,6 @@ |
1159 | 1166 | } |
1160 | 1167 | |
1161 | 1168 | if( !in_array( 'R', $flags ) || !in_array( 'N', $flags ) ) { |
1162 | | - //FIXME: may cause trouble here... |
1163 | | - //strip since it interferes with the parsing, plus, |
1164 | | - //all spaces should be stripped in this tag anyway. |
1165 | | - $this->mRules = str_replace(' ', '', $this->mRules); |
1166 | 1169 | // decode => HTML entities modified by Sanitizer::removeHTMLtags |
1167 | 1170 | $this->mRules = str_replace('=>','=>',$this->mRules); |
1168 | 1171 | |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -276,6 +276,8 @@ |
277 | 277 | * (bug 17529) rvend ignored when rvstartid is specified |
278 | 278 | * (bug 17626) Added uiprop=email to list=userinfo |
279 | 279 | * (bug 13209) Added rvdiffto parameter to prop=revisions |
| 280 | +* Manual language conversion improve: Now we can include both ";" and ":" in |
| 281 | + conversion rules |
280 | 282 | |
281 | 283 | === Languages updated in 1.15 === |
282 | 284 | |