mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-11-23 23:25:02 +00:00
Followup to r85706 and friends: now that Math messages have been moved to extension, move out the settings list and constants.
* MW_MATH_* constants are now defined in Math extension * Language::getMathNames() is removed * mathNames section in message files is removed * A hardcoded preference override in refreshLinks moved to MaintenanceRefreshLinksInit hook
This commit is contained in:
parent
23fbd97858
commit
9a767a671a
|
@ -60,10 +60,41 @@ class MathHooks {
|
||||||
global $wgLang;
|
global $wgLang;
|
||||||
$defaultPreferences['math'] = array(
|
$defaultPreferences['math'] = array(
|
||||||
'type' => 'radio',
|
'type' => 'radio',
|
||||||
'options' => array_flip( array_map( 'wfMsgHtml', $wgLang->getMathNames() ) ),
|
'options' => array_flip( array_map( 'wfMsgHtml', self::getMathNames() ) ),
|
||||||
'label' => ' ',
|
'label' => ' ',
|
||||||
'section' => 'rendering/math',
|
'section' => 'rendering/math',
|
||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of message keys for the various math output settings.
|
||||||
|
*
|
||||||
|
* @return array of strings
|
||||||
|
*/
|
||||||
|
private static function getMathNames() {
|
||||||
|
return array(
|
||||||
|
MW_MATH_PNG => 'mw_math_png',
|
||||||
|
MW_MATH_SIMPLE => 'mw_math_simple',
|
||||||
|
MW_MATH_HTML => 'mw_math_html',
|
||||||
|
MW_MATH_SOURCE => 'mw_math_source',
|
||||||
|
MW_MATH_MODERN => 'mw_math_modern',
|
||||||
|
MW_MATH_MATHML => 'mw_math_mathml'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MaintenanceRefreshLinksInit handler; optimize settings for refreshLinks batch job.
|
||||||
|
*
|
||||||
|
* @param Maintenance $maint
|
||||||
|
* @return boolean hook return code
|
||||||
|
*/
|
||||||
|
static function onMaintenanceRefreshLinksInit( $maint ) {
|
||||||
|
global $wgUser;
|
||||||
|
|
||||||
|
# Don't generate TeX PNGs (lack of a sensible current directory causes errors anyway)
|
||||||
|
$wgUser->setOption( 'math', MW_MATH_SOURCE );
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
11
Math.php
11
Math.php
|
@ -26,6 +26,17 @@ $wgExtensionCredits['parserhook'][] = array(
|
||||||
'url' => 'http://www.mediawiki.org/wiki/Extension:Math',
|
'url' => 'http://www.mediawiki.org/wiki/Extension:Math',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**@{
|
||||||
|
* Maths constants
|
||||||
|
*/
|
||||||
|
define( 'MW_MATH_PNG', 0 );
|
||||||
|
define( 'MW_MATH_SIMPLE', 1 );
|
||||||
|
define( 'MW_MATH_HTML', 2 );
|
||||||
|
define( 'MW_MATH_SOURCE', 3 );
|
||||||
|
define( 'MW_MATH_MODERN', 4 );
|
||||||
|
define( 'MW_MATH_MATHML', 5 );
|
||||||
|
/**@}*/
|
||||||
|
|
||||||
/** For back-compat */
|
/** For back-compat */
|
||||||
$wgUseTeX = true;
|
$wgUseTeX = true;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue