diff --git a/Math.php b/Math.php index b97f6a7..cb1633a 100644 --- a/Math.php +++ b/Math.php @@ -191,6 +191,9 @@ $wgMathDisableTexFilter = false; /** Stores debug information in the database and provides more detailed debug output */ $wgMathDebug = false; + +/** @var boolean $wgMathEnableExperimentalInputFormats enables experimental MathML and AsciiMath input format support */ +$wgMathEnableExperimentalInputFormats = false; ////////// end of config settings. $wgExtensionFunctions[] = 'MathHooks::setup'; diff --git a/MathRenderer.php b/MathRenderer.php index dd64ad4..d25e0c9 100644 --- a/MathRenderer.php +++ b/MathRenderer.php @@ -117,7 +117,7 @@ abstract class MathRenderer { * @return MathRenderer appropriate renderer for mode */ public static function getRenderer( $tex, $params = array(), $mode = MW_MATH_PNG ) { - global $wgDefaultUserOptions, $wgMathValidModes; + global $wgDefaultUserOptions, $wgMathValidModes, $wgMathEnableExperimentalInputFormats; $mathStyle = null; if ( isset( $params['display'] ) ) { $layoutMode = $params['display']; @@ -139,9 +139,23 @@ abstract class MathRenderer { $tex = '{\textstyle ' . $tex . '}'; } } + $id = null; + if ( isset( $params['id'] ) ) { + $id = $params['id']; + } + if ( isset( $params['forcemathmode'] ) ) { + $mode = $params['forcemathmode']; + } if ( !in_array( $mode, $wgMathValidModes ) ) { $mode = $wgDefaultUserOptions['math']; } + if ( $wgMathEnableExperimentalInputFormats === true && $mode == MW_MATH_MATHML && isset( $params['type'] ) ) { + // Support of MathML input (experimental) + // Currently support for mode MW_MATH_MATHML only + if( !in_array( $params['type'], array( 'pmml', 'ascii' ) ) ) { + unset( $params['type'] ); + } + } switch ( $mode ) { case MW_MATH_MATHJAX: case MW_MATH_SOURCE: