diff --git a/Math.php b/Math.php index d55fe66..6ed0d6c 100644 --- a/Math.php +++ b/Math.php @@ -96,6 +96,8 @@ $wgMathDirectory = false; * that's scalable for zooming, printing, and high-resolution displays. * * Not guaranteed to be stable at this time. + * + * @todo Rename to $wgMathJax */ $wgUseMathJax = false; @@ -104,15 +106,15 @@ $wgUseMathJax = false; * * * If you want or need to run your own server, follow these installation - * instructions and override $wgLaTeXMLUrl: - * + * instructions and override $wgMathLaTeXMLUrl: + * * * If you expect heavy load you can specify multiple servers. In that case one * server is randomly chosen for each rendering process. Specify the list of - * servers in an array e.g $wgLaTeXMLUrl = array ( 'http://latexml.example.com/convert', + * servers in an array e.g $wgMathLaTeXMLUrl = array ( 'http://latexml.example.com/convert', * 'http://latexml2.example.com/convert'); */ -$wgLaTeXMLUrl = 'http://latexml.mathweb.org/convert'; +$wgMathLaTeXMLUrl = 'http://latexml.mathweb.org/convert'; /** * Allows to use LaTeXML as renderer for mathematical equation. @@ -123,12 +125,12 @@ $wgUseLaTeXML = false; * The timeout for the HTTP-Request sent to the LaTeXML to render an equation, * in seconds. */ -$wgLaTeXMLTimeout = 240; +$wgMathLaTeXMLTimeout = 240; /** * Setting for the LaTeXML renderer. * See http://dlmf.nist.gov/LaTeXML/manual/commands/latexmlpost.xhtml for details. */ -$wgDefaultLaTeXMLSetting = 'format=xhtml&whatsin=math&whatsout=math&pmml&cmml&nodefaultresources&preload=LaTeX.pool&preload=article.cls&preload=amsmath.sty&preload=amsthm.sty&preload=amstext.sty&preload=amssymb.sty&preload=eucal.sty&preload=[dvipsnames]xcolor.sty&preload=url.sty&preload=hyperref.sty&preload=[ids]latexml.sty&preload=texvc'; +$wgMathDefaultLaTeXMLSetting = 'format=xhtml&whatsin=math&whatsout=math&pmml&cmml&nodefaultresources&preload=LaTeX.pool&preload=article.cls&preload=amsmath.sty&preload=amsthm.sty&preload=amstext.sty&preload=amssymb.sty&preload=eucal.sty&preload=[dvipsnames]xcolor.sty&preload=url.sty&preload=hyperref.sty&preload=[ids]latexml.sty&preload=texvc'; /** * The link to the texvc executable */ diff --git a/MathLaTeXML.php b/MathLaTeXML.php index 14aea29..f3dce52 100644 --- a/MathLaTeXML.php +++ b/MathLaTeXML.php @@ -35,15 +35,15 @@ class MathLaTeXML extends MathRenderer { } /** * Gets the settings for the LaTeXML daemon. - * + * @global type $wgMathDefaultLaTeXMLSetting * @return string */ public function getLaTeXMLSettings() { - global $wgDefaultLaTeXMLSetting; + global $wgMathDefaultLaTeXMLSetting; if ( $this->LaTeXMLSettings ) { return $this->LaTeXMLSettings; } else { - return $wgDefaultLaTeXMLSetting; + return $wgMathDefaultLaTeXMLSetting; } } @@ -106,10 +106,11 @@ class MathLaTeXML extends MathRenderer { /** * Performs a HTTP Post request to the given host. - * Uses $wgLaTeXMLTimeout as timeout. + * Uses $wgMathLaTeXMLTimeout as timeout. * Generates error messages on failure * @see Http::post() * + * @global type $wgMathLaTeXMLTimeout * @param string $host * @param string $post the encoded post request * @param mixed $res the result @@ -118,12 +119,12 @@ class MathLaTeXML extends MathRenderer { * @return boolean success */ public function makeRequest( $host, $post, &$res, &$error = '', $httpRequestClass = 'MWHttpRequest' ) { - global $wgLaTeXMLTimeout; + global $wgMathLaTeXMLTimeout; wfProfileIn( __METHOD__ ); $error = ''; $res = null; - $options = array( 'method' => 'POST', 'postData' => $post, 'timeout' => $wgLaTeXMLTimeout ); + $options = array( 'method' => 'POST', 'postData' => $post, 'timeout' => $wgMathLaTeXMLTimeout ); $req = $httpRequestClass::factory( $host, $options ); $status = $req->execute(); if ( $status->isGood() ) { @@ -136,7 +137,7 @@ class MathLaTeXML extends MathRenderer { $res = false; wfDebugLog( "Math", "\nLaTeXML Timeout:" . var_export( array( 'post' => $post, 'host' => $host - , 'wgLaTeXMLTimeout' => $wgLaTeXMLTimeout ), true ) . "\n\n" ); + , 'timeout' => $wgMathLaTeXMLTimeout ), true ) . "\n\n" ); } else { // for any other unkonwn http error $errormsg = $status->getHtml(); @@ -162,15 +163,15 @@ class MathLaTeXML extends MathRenderer { /** * Picks a LaTeXML daemon. * If more than one demon are availible one is chosen from the - * $wgLaTeXMLUrl array. + * $wgMathLaTeXMLUrl array. * @return string */ private static function pickHost() { - global $wgLaTeXMLUrl; - if ( is_array( $wgLaTeXMLUrl ) ) { - $host = array_rand( $wgLaTeXMLUrl ); + global $wgMathLaTeXMLUrl; + if ( is_array( $wgMathLaTeXMLUrl ) ) { + $host = array_rand( $wgMathLaTeXMLUrl ); } else { - $host = $wgLaTeXMLUrl; + $host = $wgMathLaTeXMLUrl; } wfDebugLog( "Math", "picking host " . $host ); return $host; diff --git a/RELEASE-NOTES-2.0 b/RELEASE-NOTES-2.0 new file mode 100644 index 0000000..e6c9842 --- /dev/null +++ b/RELEASE-NOTES-2.0 @@ -0,0 +1,10 @@ +== Math 2.0 == + +THIS IS NOT A RELEASE YET + +Math 2.0 is an alpha-quality branch and is not recommended for use in +production. + +=== Configuration changes in 2.0 === +* $wgLaTeXMLUrl was renamed to $wgMathLaTeXMLUrl +* $wgLaTeXMLUrl was renamed to $wgMathLaTeXMLTimeout diff --git a/tests/MathLaTeXMLTest.php b/tests/MathLaTeXMLTest.php index a549977..4c103c7 100644 --- a/tests/MathLaTeXMLTest.php +++ b/tests/MathLaTeXMLTest.php @@ -125,8 +125,8 @@ class MathLaTeXMLTest extends MediaWikiTestCase { * i.e. if the span element is generated right. */ public function testIntegration() { - global $wgLaTeXMLTimeout; - $wgLaTeXMLTimeout = 20; + global $wgMathLaTeXMLTimeout; + $wgMathLaTeXMLTimeout = 20; $renderer = MathRenderer::getRenderer( "a+b", array(), MW_MATH_LATEXML ); $real = $renderer->render( true ); $expected = ' a + b a b a+b ';