Physikerwelt has submitted this change and it was merged.

Change subject: Fix bugs for 0, and textonly
......................................................................


Fix bugs for 0, and textonly

Fixes some issues in LaTeXML-driver for special cases if
* input $0$
* input is text only

Change-Id: Ic8897ef6dec09bac7fd0a48d84200fa7178bd001
---
M MathLaTeXML.php
M MathMathML.php
M tests/MathLaTeXMLTest.php
3 files changed, 6 insertions(+), 9 deletions(-)

Approvals:
  Physikerwelt: Verified; Looks good to me, approved



diff --git a/MathLaTeXML.php b/MathLaTeXML.php
index 669513b..d8b319c 100644
--- a/MathLaTeXML.php
+++ b/MathLaTeXML.php
@@ -10,7 +10,7 @@
  * @file
  */
 class MathLaTeXML extends MathMathML {
-       protected static $DEFAULT_ALLOWED_ROOT_ELEMENTS = array( 'math', 'div', 
'table', 'query' );
+       protected $defaultAllowedRootElements = array( 'math', 'div', 'table', 
'query' );
        /** @var String settings for LaTeXML daemon      */
        private $LaTeXMLSettings = '';
        /** @var boolean if false LaTeXML output is not validated*/
@@ -92,8 +92,8 @@
         * @return boolean
         */
        protected function doRender() {
-               global $wgMathDefaultLaTeXMLSetting, $wgMathDebug;
-               if ( !$this->getTex() ) {
+               global $wgMathDebug;
+               if ( trim( $this->getTex() ) === '' ) {
                        wfDebugLog( "Math", "Rendering was requested, but no 
TeX string is specified." );
                        $this->lastError = $this->getError( 'math_empty_tex' );
                        return false;
diff --git a/MathMathML.php b/MathMathML.php
index 5886987..48b8b56 100644
--- a/MathMathML.php
+++ b/MathMathML.php
@@ -11,7 +11,7 @@
  */
 class MathMathML extends MathRenderer {
 
-       protected static $DEFAULT_ALLOWED_ROOT_ELEMENTS = array( 'math' );
+       protected $defaultAllowedRootElements = array( 'math' );
        protected $allowedRootElements = '';
        protected $hosts;
 
@@ -30,7 +30,7 @@
                if ( $this->allowedRootElements ) {
                        return $this->allowedRootElements;
                } else {
-                       return self::$DEFAULT_ALLOWED_ROOT_ELEMENTS;
+                       return $this->defaultAllowedRootElements;
                }
        }
 
@@ -163,7 +163,6 @@
         * @return string HTTP POST data
         */
        public function getPostData() {
-               global $wgMathValidModes;
                $tex = $this->getTex();
                if ( is_null( $this->getDisplaystyle() ) ) {
                        // default preserve the (broken) layout as it was
@@ -184,7 +183,7 @@
         * @return boolean
         */
        protected function doRender() {
-               global  $wgMathDebug, $wgMathValidModes;
+               global  $wgMathDebug;
                if ( $this->getTex() === '' ) {
                        wfDebugLog( 'Math', 'Rendering was requested, but no 
TeX string is specified.' );
                        $this->lastError = $this->getError( 'math_empty_tex' );
diff --git a/tests/MathLaTeXMLTest.php b/tests/MathLaTeXMLTest.php
index 6529300..2424a34 100644
--- a/tests/MathLaTeXMLTest.php
+++ b/tests/MathLaTeXMLTest.php
@@ -19,8 +19,6 @@
        public function testSpecialCase0() {
                global $wgMathFastDisplay;
                $wgMathFastDisplay = false;
-               // FIXME:
-               $this->markTestSkipped( "Bug in LaTeXML" );
                $renderer = MathRenderer::getRenderer( '0', array( ), 
MW_MATH_LATEXML );
                $expected = '0</cn>';
                $this->assertTrue( $renderer->render() );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic8897ef6dec09bac7fd0a48d84200fa7178bd001
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Math
Gerrit-Branch: dev
Gerrit-Owner: Physikerwelt <w...@physikerwelt.de>
Gerrit-Reviewer: Physikerwelt <w...@physikerwelt.de>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to