Merge branch 'master' of https://git.qiuwen.wiki/mirror/SimpleMathJax into dev
Conflicts: extension.json
这个提交包含在:
当前提交
f82bb86290
|
@ -1,4 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
class SimpleMathJaxHooks {
|
class SimpleMathJaxHooks {
|
||||||
|
|
||||||
public static function onParserFirstCallInit( Parser $parser ) {
|
public static function onParserFirstCallInit( Parser $parser ) {
|
||||||
|
@ -13,6 +13,8 @@ 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 );
|
||||||
|
$wgOut->addModules( [ 'ext.SimpleMathJax' ] );
|
||||||
|
$wgOut->addModules( [ 'ext.SimpleMathJax.mobile' ] ); // For MobileFrontend
|
||||||
|
|
||||||
$parser->setHook( 'math', __CLASS__ . '::renderMath' );
|
$parser->setHook( 'math', __CLASS__ . '::renderMath' );
|
||||||
if( $wgSmjUseChem ) $parser->setHook( 'chem', __CLASS__ . '::renderChem' ); }
|
if( $wgSmjUseChem ) $parser->setHook( 'chem', __CLASS__ . '::renderChem' ); }
|
||||||
|
@ -31,8 +33,6 @@ class SimpleMathJaxHooks {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function renderTex($tex, $parser) {
|
private static function renderTex($tex, $parser) {
|
||||||
$parser->getOutput()->addModules( 'ext.SimpleMathJax' );
|
|
||||||
$parser->getOutput()->addModules( 'ext.SimpleMathJax.mobile' ); // For MobileFrontend
|
|
||||||
$attributes = [ "style" => "opacity:.5" ];
|
$attributes = [ "style" => "opacity:.5" ];
|
||||||
Hooks::run( "SimpleMathJaxAttributes", [ &$attributes, $tex ] );
|
Hooks::run( "SimpleMathJaxAttributes", [ &$attributes, $tex ] );
|
||||||
$element = Html::Element( "span", $attributes, "[math]{$tex}[/math]" );
|
$element = Html::Element( "span", $attributes, "[math]{$tex}[/math]" );
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "SimpleMathJax",
|
"name": "SimpleMathJax",
|
||||||
"version": "0.8.2",
|
"version": "0.8.3",
|
||||||
"author": [
|
"author": [
|
||||||
"jmnote",
|
"jmnote",
|
||||||
"Qiuwen Baike Contributors"
|
"Qiuwen Baike Contributors"
|
||||||
|
@ -27,7 +27,8 @@
|
||||||
},
|
},
|
||||||
"ResourceModules": {
|
"ResourceModules": {
|
||||||
"ext.SimpleMathJax": {
|
"ext.SimpleMathJax": {
|
||||||
"scripts": ["resources/ext.SimpleMathJax.js"]
|
"scripts": ["resources/ext.SimpleMathJax.js"],
|
||||||
|
"targets": ["desktop", "mobile"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ResourceFileModulePaths": {
|
"ResourceFileModulePaths": {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
mw.hook( 'wikipage.categories' ).add( function ( $content ) {
|
mw.hook( 'wikipage.content' ).add( function ( $content ) {
|
||||||
window.MathJax = {
|
window.MathJax = {
|
||||||
tex: {
|
tex: {
|
||||||
inlineMath: mw.config.get('wgSmjExtraInlineMath').concat([['[math]','[/math]']]),
|
inlineMath: mw.config.get('wgSmjExtraInlineMath').concat([['[math]','[/math]']]),
|
||||||
|
|
正在加载...
在新工单中引用