$variant = $this->getPreferredVariant();
$index = $title->getNamespace();
if ( $index !== NS_MAIN ) {
- $text = $this->convertNamespace( $index ) . ':';
+ $text = $this->convertNamespace( $index, $variant ) . ':';
} else {
$text = '';
}
* Get the namespace display name in the preferred variant.
*
* @param $index int namespace id
+ * @param $variant string|null variant code or null for preferred variant
* @return String: namespace name for display
*/
- public function convertNamespace( $index ) {
- $variant = $this->getPreferredVariant();
+ public function convertNamespace( $index, $variant = null ) {
+ if ( $variant === null ) {
+ $variant = $this->getPreferredVariant();
+ }
if ( $index === NS_MAIN ) {
return '';
} else {
* @param $text String: text to armour against conversion
* @return String: armoured text where { and } have been converted to
* { and }
+ * @deprecated since 1.22 is no longer used
*/
public function armourMath( $text ) {
// convert '-{' and '}-' to '-{' and '}-' to prevent
$variants = $this->mConverter->mVariants;
$varsep_pattern = $this->mConverter->getVarSeparatorPattern();
+ // Split according to $varsep_pattern, but ignore semicolons from HTML entities
+ $rules = preg_replace( '/(&[#a-zA-Z0-9]+);/', "$1\x01", $rules );
$choice = preg_split( $varsep_pattern, $rules );
+ $choice = str_replace( "\x01", ';', $choice );
foreach ( $choice as $c ) {
$v = explode( ':', $c, 2 );