From 3158d844b58082f6e8c5b0918a7b23b85f648d08 Mon Sep 17 00:00:00 2001 From: "Mark A. Hershberger" Date: Tue, 10 Nov 2020 21:54:56 -0500 Subject: [PATCH] Add editorconfig file for MW defaults and tidy eol w/s --- .editorconfig | 12 ++++++++++++ SimpleMathJaxHooks.php | 13 ++++--------- 2 files changed, 16 insertions(+), 9 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..c59c447b --- /dev/null +++ b/.editorconfig @@ -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 diff --git a/SimpleMathJaxHooks.php b/SimpleMathJaxHooks.php index 7d15e8be..a14748b3 100644 --- a/SimpleMathJaxHooks.php +++ b/SimpleMathJaxHooks.php @@ -13,16 +13,16 @@ class SimpleMathJaxHooks { $wgOut->addJsConfigVars( 'wgSmjScale', $wgSmjScale ); $wgOut->addJsConfigVars( 'wgSmjEnableMenu', $wgSmjEnableMenu ); $wgOut->addJsConfigVars( 'wgSmjDisplayAlign', $wgSmjDisplayAlign ); - + $parser->setHook( 'math', __CLASS__ . '::renderMath' ); if( $wgSmjUseChem ) $parser->setHook( 'chem', __CLASS__ . '::renderChem' ); } - + public static function renderMath($tex, array $args, Parser $parser, PPFrame $frame ) { global $wgSmjWrapDisplaystyle; $tex = str_replace('\>', '\;', $tex); $tex = str_replace('<', '\lt ', $tex); $tex = str_replace('>', '\gt ', $tex); - if( $wgSmjWrapDisplaystyle ) $tex = "\displaystyle{ $tex }"; + if( $wgSmjWrapDisplaystyle ) $tex = "\displaystyle{ $tex }"; return self::renderTex($tex, $parser); } @@ -31,13 +31,8 @@ class SimpleMathJaxHooks { } private static function renderTex($tex, $parser) { - $parser->getOutput()->addModules( 'ext.SimpleMathJax' ); + $parser->getOutput()->addModules( 'ext.SimpleMathJax' ); $parser->getOutput()->addModules( 'ext.SimpleMathJax.mobile' ); // For MobileFrontend return ["[math]${tex}[/math]", 'markerType'=>'nowiki']; } } - - - - -