Merge "Enable restBaseless rendering"

This commit is contained in:
jenkins-bot 2024-06-24 08:30:31 +00:00 committed by Gerrit Code Review
commit 090c6c0b0b
3 changed files with 10 additions and 4 deletions

View file

@ -121,6 +121,10 @@
"description": "Determine which TexVC variant is used, currently available: 'mathoid', 'restbase' (default) and 'local'.",
"value": "restbase"
},
"MathSvgRenderer": {
"description": "Determine which SVG rendering service is used. Currently available 'mathoid', 'restbase'.",
"value": "restbase"
},
"MathLaTeXMLTimeout": {
"value": 240
},

View file

@ -77,6 +77,7 @@ class ParserHooksHandler implements
* @return array|string
*/
public function mathTagHook( ?string $content, array $attributes, Parser $parser ) {
global $wgMathSvgRenderer;
$mode = $parser->getOptions()->getOption( 'math' );
if ( $mode === MathConfig::MODE_NATIVE_JAX ) {
$parser->getOutput()->addModules( [ 'ext.math.mathjax' ] );
@ -88,7 +89,7 @@ class ParserHooksHandler implements
if ( array_key_exists( "qid", $attributes ) ) {
$parser->getOutput()->addModules( [ 'ext.math.popup' ] );
}
if ( $mode == MathConfig::MODE_MATHML ) {
if ( $wgMathSvgRenderer === 'restbase' && $mode == MathConfig::MODE_MATHML ) {
$marker = Parser::MARKER_PREFIX .
'-postMath-' . sprintf( '%08X', $this->mathTagCounter++ ) .
Parser::MARKER_SUFFIX;

View file

@ -136,9 +136,10 @@ class MathMathML extends MathRenderer {
}
public function render() {
global $wgMathFullRestbaseURL;
global $wgMathFullRestbaseURL, $wgMathSvgRenderer;
try {
if ( in_array( $this->inputType, $this->restbaseInputTypes, true ) &&
if ( $wgMathSvgRenderer === 'restbase' &&
in_array( $this->inputType, $this->restbaseInputTypes, true ) &&
in_array( $this->mode, $this->restbaseRenderingModes, true )
) {
if ( !$this->rbi ) {