Merge "Rename some global variables that violate the naming convention"

This commit is contained in:
jenkins-bot 2014-02-03 18:50:13 +00:00 committed by Gerrit Code Review
commit 013cb70749
4 changed files with 33 additions and 20 deletions

View File

@ -96,6 +96,8 @@ $wgMathDirectory = false;
* that's scalable for zooming, printing, and high-resolution displays. * that's scalable for zooming, printing, and high-resolution displays.
* *
* Not guaranteed to be stable at this time. * Not guaranteed to be stable at this time.
*
* @todo Rename to $wgMathJax
*/ */
$wgUseMathJax = false; $wgUseMathJax = false;
@ -104,15 +106,15 @@ $wgUseMathJax = false;
* <http://latexml.mathweb.org/help> * <http://latexml.mathweb.org/help>
* *
* If you want or need to run your own server, follow these installation * If you want or need to run your own server, follow these installation
* instructions and override $wgLaTeXMLUrl: * instructions and override $wgMathLaTeXMLUrl:
* <https://svn.mathweb.org/repos/LaTeXML/branches/arXMLiv/INSTALL> * <http://www.formulasearchengine.com/LaTeXML>
* *
* If you expect heavy load you can specify multiple servers. In that case one * 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 * 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'); * '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. * 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, * The timeout for the HTTP-Request sent to the LaTeXML to render an equation,
* in seconds. * in seconds.
*/ */
$wgLaTeXMLTimeout = 240; $wgMathLaTeXMLTimeout = 240;
/** /**
* Setting for the LaTeXML renderer. * Setting for the LaTeXML renderer.
* See http://dlmf.nist.gov/LaTeXML/manual/commands/latexmlpost.xhtml for details. * 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 * The link to the texvc executable
*/ */

View File

@ -35,15 +35,15 @@ class MathLaTeXML extends MathRenderer {
} }
/** /**
* Gets the settings for the LaTeXML daemon. * Gets the settings for the LaTeXML daemon.
* * @global type $wgMathDefaultLaTeXMLSetting
* @return string * @return string
*/ */
public function getLaTeXMLSettings() { public function getLaTeXMLSettings() {
global $wgDefaultLaTeXMLSetting; global $wgMathDefaultLaTeXMLSetting;
if ( $this->LaTeXMLSettings ) { if ( $this->LaTeXMLSettings ) {
return $this->LaTeXMLSettings; return $this->LaTeXMLSettings;
} else { } else {
return $wgDefaultLaTeXMLSetting; return $wgMathDefaultLaTeXMLSetting;
} }
} }
@ -106,10 +106,11 @@ class MathLaTeXML extends MathRenderer {
/** /**
* Performs a HTTP Post request to the given host. * Performs a HTTP Post request to the given host.
* Uses $wgLaTeXMLTimeout as timeout. * Uses $wgMathLaTeXMLTimeout as timeout.
* Generates error messages on failure * Generates error messages on failure
* @see Http::post() * @see Http::post()
* *
* @global type $wgMathLaTeXMLTimeout
* @param string $host * @param string $host
* @param string $post the encoded post request * @param string $post the encoded post request
* @param mixed $res the result * @param mixed $res the result
@ -118,12 +119,12 @@ class MathLaTeXML extends MathRenderer {
* @return boolean success * @return boolean success
*/ */
public function makeRequest( $host, $post, &$res, &$error = '', $httpRequestClass = 'MWHttpRequest' ) { public function makeRequest( $host, $post, &$res, &$error = '', $httpRequestClass = 'MWHttpRequest' ) {
global $wgLaTeXMLTimeout; global $wgMathLaTeXMLTimeout;
wfProfileIn( __METHOD__ ); wfProfileIn( __METHOD__ );
$error = ''; $error = '';
$res = null; $res = null;
$options = array( 'method' => 'POST', 'postData' => $post, 'timeout' => $wgLaTeXMLTimeout ); $options = array( 'method' => 'POST', 'postData' => $post, 'timeout' => $wgMathLaTeXMLTimeout );
$req = $httpRequestClass::factory( $host, $options ); $req = $httpRequestClass::factory( $host, $options );
$status = $req->execute(); $status = $req->execute();
if ( $status->isGood() ) { if ( $status->isGood() ) {
@ -136,7 +137,7 @@ class MathLaTeXML extends MathRenderer {
$res = false; $res = false;
wfDebugLog( "Math", "\nLaTeXML Timeout:" wfDebugLog( "Math", "\nLaTeXML Timeout:"
. var_export( array( 'post' => $post, 'host' => $host . var_export( array( 'post' => $post, 'host' => $host
, 'wgLaTeXMLTimeout' => $wgLaTeXMLTimeout ), true ) . "\n\n" ); , 'timeout' => $wgMathLaTeXMLTimeout ), true ) . "\n\n" );
} else { } else {
// for any other unkonwn http error // for any other unkonwn http error
$errormsg = $status->getHtml(); $errormsg = $status->getHtml();
@ -162,15 +163,15 @@ class MathLaTeXML extends MathRenderer {
/** /**
* Picks a LaTeXML daemon. * Picks a LaTeXML daemon.
* If more than one demon are availible one is chosen from the * If more than one demon are availible one is chosen from the
* $wgLaTeXMLUrl array. * $wgMathLaTeXMLUrl array.
* @return string * @return string
*/ */
private static function pickHost() { private static function pickHost() {
global $wgLaTeXMLUrl; global $wgMathLaTeXMLUrl;
if ( is_array( $wgLaTeXMLUrl ) ) { if ( is_array( $wgMathLaTeXMLUrl ) ) {
$host = array_rand( $wgLaTeXMLUrl ); $host = array_rand( $wgMathLaTeXMLUrl );
} else { } else {
$host = $wgLaTeXMLUrl; $host = $wgMathLaTeXMLUrl;
} }
wfDebugLog( "Math", "picking host " . $host ); wfDebugLog( "Math", "picking host " . $host );
return $host; return $host;

10
RELEASE-NOTES-2.0 Normal file
View File

@ -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

View File

@ -125,8 +125,8 @@ class MathLaTeXMLTest extends MediaWikiTestCase {
* i.e. if the span element is generated right. * i.e. if the span element is generated right.
*/ */
public function testIntegration() { public function testIntegration() {
global $wgLaTeXMLTimeout; global $wgMathLaTeXMLTimeout;
$wgLaTeXMLTimeout = 20; $wgMathLaTeXMLTimeout = 20;
$renderer = MathRenderer::getRenderer( "a+b", array(), MW_MATH_LATEXML ); $renderer = MathRenderer::getRenderer( "a+b", array(), MW_MATH_LATEXML );
$real = $renderer->render( true ); $real = $renderer->render( true );
$expected = '<span class="tex" dir="ltr" id="a_b"><math xmlns="http://www.w3.org/1998/Math/MathML" id="p1.1.m1" class="ltx_Math" alttext="a+b" display="inline" xml:id="p1.1.m1.1" xref="p1.1.m1.1.cmml"> <semantics xml:id="p1.1.m1.1a" xref="p1.1.m1.1.cmml"> <mrow xml:id="p1.1.m1.1.4" xref="p1.1.m1.1.4.cmml"> <mi xml:id="p1.1.m1.1.1" xref="p1.1.m1.1.1.cmml">a</mi> <mo xml:id="p1.1.m1.1.2" xref="p1.1.m1.1.2.cmml">+</mo> <mi xml:id="p1.1.m1.1.3" xref="p1.1.m1.1.3.cmml">b</mi> </mrow> <annotation-xml encoding="MathML-Content" xml:id="p1.1.m1.1.cmml" xref="p1.1.m1.1"> <apply xml:id="p1.1.m1.1.4.cmml" xref="p1.1.m1.1.4"> <plus xml:id="p1.1.m1.1.2.cmml" xref="p1.1.m1.1.2"/> <ci xml:id="p1.1.m1.1.1.cmml" xref="p1.1.m1.1.1">a</ci> <ci xml:id="p1.1.m1.1.3.cmml" xref="p1.1.m1.1.3">b</ci> </apply> </annotation-xml> <annotation encoding="application/x-tex" xml:id="p1.1.m1.1b" xref="p1.1.m1.1.cmml">a+b</annotation> </semantics> </math></span>'; $expected = '<span class="tex" dir="ltr" id="a_b"><math xmlns="http://www.w3.org/1998/Math/MathML" id="p1.1.m1" class="ltx_Math" alttext="a+b" display="inline" xml:id="p1.1.m1.1" xref="p1.1.m1.1.cmml"> <semantics xml:id="p1.1.m1.1a" xref="p1.1.m1.1.cmml"> <mrow xml:id="p1.1.m1.1.4" xref="p1.1.m1.1.4.cmml"> <mi xml:id="p1.1.m1.1.1" xref="p1.1.m1.1.1.cmml">a</mi> <mo xml:id="p1.1.m1.1.2" xref="p1.1.m1.1.2.cmml">+</mo> <mi xml:id="p1.1.m1.1.3" xref="p1.1.m1.1.3.cmml">b</mi> </mrow> <annotation-xml encoding="MathML-Content" xml:id="p1.1.m1.1.cmml" xref="p1.1.m1.1"> <apply xml:id="p1.1.m1.1.4.cmml" xref="p1.1.m1.1.4"> <plus xml:id="p1.1.m1.1.2.cmml" xref="p1.1.m1.1.2"/> <ci xml:id="p1.1.m1.1.1.cmml" xref="p1.1.m1.1.1">a</ci> <ci xml:id="p1.1.m1.1.3.cmml" xref="p1.1.m1.1.3">b</ci> </apply> </annotation-xml> <annotation encoding="application/x-tex" xml:id="p1.1.m1.1b" xref="p1.1.m1.1.cmml">a+b</annotation> </semantics> </math></span>';