Physikerwelt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/279197

Change subject: Insert MathML content after tidy
......................................................................

Insert MathML content after tidy

* BeforeTidy caused problems when math tags were used
  within links.

Bug: T130508
Change-Id: Icb9b88a7552d14231f96cbfd2b3cf3fa7e29276d
---
M Math.hooks.php
M extension.json
M tests/MathMathMLTest.php
3 files changed, 12 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Math 
refs/changes/97/279197/1

diff --git a/Math.hooks.php b/Math.hooks.php
index 57f75bf..2fc6b5f 100644
--- a/Math.hooks.php
+++ b/Math.hooks.php
@@ -373,7 +373,7 @@
         * @param $text
         * @return bool
         */
-       public static function onParserBeforeTidy( &$parser, &$text ) {
+       public static function onParserAfterTidy( &$parser, &$text ) {
                $rbis = array();
                foreach ( self::$tags as $key => $tag ){
                        /** @var MathRenderer $renderer */
diff --git a/extension.json b/extension.json
index 9db5772..75d1cdc 100644
--- a/extension.json
+++ b/extension.json
@@ -69,8 +69,8 @@
                "WikibaseRepoDataTypes": [
                        "MathWikidataHook::onWikibaseRepoDataTypes"
                ],
-               "ParserBeforeTidy":[
-                       "MathHooks::onParserBeforeTidy"
+               "ParserAfterTidy":[
+                       "MathHooks::onParserAfterTidy"
                ]
        },
        "config": {
diff --git a/tests/MathMathMLTest.php b/tests/MathMathMLTest.php
index ba730b8..8d196ca 100644
--- a/tests/MathMathMLTest.php
+++ b/tests/MathMathMLTest.php
@@ -111,6 +111,15 @@
                        'test if math expression is invalid mathml sample' );
        }
 
+       public function testintegrationTestWithLinks() {
+               $p = new Parser();
+               $po = new ParserOptions();
+               $t = new Title( "test" );
+               $res = $p->parse( '[[test|<math 
forcemathmode="mathml">a+b</math>]]', $t, $po )->getText();
+               $this->assertContains( '</a>', $res );
+               $this->assertContains( '</mi>', $res );
+       }
+
 }
 
 /**

-- 
To view, visit https://gerrit.wikimedia.org/r/279197
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icb9b88a7552d14231f96cbfd2b3cf3fa7e29276d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Math
Gerrit-Branch: master
Gerrit-Owner: Physikerwelt <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to