父节点
45d7543379
当前提交
3158d844b5
|
@ -0,0 +1,12 @@
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
indent_style = tab
|
||||||
|
indent_size = 4
|
||||||
|
end_of_line = lf
|
||||||
|
charset = utf-8
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
trim_trailing_whitespace = false
|
|
@ -13,16 +13,16 @@ class SimpleMathJaxHooks {
|
||||||
$wgOut->addJsConfigVars( 'wgSmjScale', $wgSmjScale );
|
$wgOut->addJsConfigVars( 'wgSmjScale', $wgSmjScale );
|
||||||
$wgOut->addJsConfigVars( 'wgSmjEnableMenu', $wgSmjEnableMenu );
|
$wgOut->addJsConfigVars( 'wgSmjEnableMenu', $wgSmjEnableMenu );
|
||||||
$wgOut->addJsConfigVars( 'wgSmjDisplayAlign', $wgSmjDisplayAlign );
|
$wgOut->addJsConfigVars( 'wgSmjDisplayAlign', $wgSmjDisplayAlign );
|
||||||
|
|
||||||
$parser->setHook( 'math', __CLASS__ . '::renderMath' );
|
$parser->setHook( 'math', __CLASS__ . '::renderMath' );
|
||||||
if( $wgSmjUseChem ) $parser->setHook( 'chem', __CLASS__ . '::renderChem' ); }
|
if( $wgSmjUseChem ) $parser->setHook( 'chem', __CLASS__ . '::renderChem' ); }
|
||||||
|
|
||||||
public static function renderMath($tex, array $args, Parser $parser, PPFrame $frame ) {
|
public static function renderMath($tex, array $args, Parser $parser, PPFrame $frame ) {
|
||||||
global $wgSmjWrapDisplaystyle;
|
global $wgSmjWrapDisplaystyle;
|
||||||
$tex = str_replace('\>', '\;', $tex);
|
$tex = str_replace('\>', '\;', $tex);
|
||||||
$tex = str_replace('<', '\lt ', $tex);
|
$tex = str_replace('<', '\lt ', $tex);
|
||||||
$tex = str_replace('>', '\gt ', $tex);
|
$tex = str_replace('>', '\gt ', $tex);
|
||||||
if( $wgSmjWrapDisplaystyle ) $tex = "\displaystyle{ $tex }";
|
if( $wgSmjWrapDisplaystyle ) $tex = "\displaystyle{ $tex }";
|
||||||
return self::renderTex($tex, $parser);
|
return self::renderTex($tex, $parser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,13 +31,8 @@ class SimpleMathJaxHooks {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function renderTex($tex, $parser) {
|
private static function renderTex($tex, $parser) {
|
||||||
$parser->getOutput()->addModules( 'ext.SimpleMathJax' );
|
$parser->getOutput()->addModules( 'ext.SimpleMathJax' );
|
||||||
$parser->getOutput()->addModules( 'ext.SimpleMathJax.mobile' ); // For MobileFrontend
|
$parser->getOutput()->addModules( 'ext.SimpleMathJax.mobile' ); // For MobileFrontend
|
||||||
return ["<span style='opacity:.5'>[math]${tex}[/math]</span>", 'markerType'=>'nowiki'];
|
return ["<span style='opacity:.5'>[math]${tex}[/math]</span>", 'markerType'=>'nowiki'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
正在加载...
在新工单中引用