Physikerwelt has submitted this change and it was merged. Change subject: Add inputhash as id for mathml element ......................................................................
Add inputhash as id for mathml element To identify the MathML-element in the page it is helpful have the inputhash in the mathml element. The alttext field is not really suitable as a key. Change-Id: I1f9b352bbb70405bb6ab22f0094d81ae9cf2c80a --- M MathLaTeXML.php M MathMathML.php 2 files changed, 6 insertions(+), 2 deletions(-) Approvals: Physikerwelt: Verified; Looks good to me, approved diff --git a/MathLaTeXML.php b/MathLaTeXML.php index d8b319c..08a7b53 100644 --- a/MathLaTeXML.php +++ b/MathLaTeXML.php @@ -112,7 +112,9 @@ $result = json_decode( $res ); if ( $result && json_last_error() === JSON_ERROR_NONE ) { if ( $this->isValidMathML( $result->result ) ) { - $this->setMathml( $result->result ); + //add inputhash as id to the MathML element + $mml = preg_replace( '/id="p1.1.m1"/', 'id="' . $this->getMd5() . '"' , $result->result , 1); + $this->setMathml( $mml ); if ( $wgMathDebug ) { $this->setLog( $result->log ); $this->setStatusCode( $result->status_code ); diff --git a/MathMathML.php b/MathMathML.php index 48b8b56..4dc630c 100644 --- a/MathMathML.php +++ b/MathMathML.php @@ -210,7 +210,9 @@ $this->setLog( $result->log ); } if ( $this->getMode() != MW_MATH_LATEXML ) { - $this->setMathml( $result->mml ); + //add the inputhash used for the generation to the MathML element + $mml = '<math id="' . $this->getMd5() . '" ' . substr( $result->mml , 5 ); + $this->setMathml( $mml ); } return true; } else { -- To view, visit https://gerrit.wikimedia.org/r/116931 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I1f9b352bbb70405bb6ab22f0094d81ae9cf2c80a Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/Math Gerrit-Branch: dev Gerrit-Owner: Physikerwelt <w...@physikerwelt.de> Gerrit-Reviewer: Physikerwelt <w...@physikerwelt.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits