| Index: trunk/phase3/includes/parser/CoreTagHooks.php |
| — | — | @@ -40,7 +40,7 @@ |
| 41 | 41 | |
| 42 | 42 | static function math( $content, $attributes, $parser ) { |
| 43 | 43 | global $wgContLang; |
| 44 | | - return $wgContLang->armourMath( MathRenderer::renderMath( $content, $attributes ) ); |
| | 44 | + return $wgContLang->armourMath( MathRenderer::renderMath( $content, $attributes, $parser->mOptions ) ); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | static function gallery( $content, $attributes, $parser ) { |
| Index: trunk/phase3/includes/parser/ParserOptions.php |
| — | — | @@ -54,6 +54,8 @@ |
| 55 | 55 | function getEnableLimitReport() { return $this->mEnableLimitReport; } |
| 56 | 56 | function getCleanSignatures() { return $this->mCleanSignatures; } |
| 57 | 57 | function getExternalLinkTarget() { return $this->mExternalLinkTarget; } |
| | 58 | + function getMath() { return $this->mMath; } |
| | 59 | + |
| 58 | 60 | function getIsPreview() { return $this->mIsPreview; } |
| 59 | 61 | function getIsSectionPreview() { return $this->mIsSectionPreview; } |
| 60 | 62 | function getIsPrintable() { return $this->mIsPrintable; } |
| — | — | @@ -66,6 +68,10 @@ |
| 67 | 69 | } |
| 68 | 70 | |
| 69 | 71 | function getDateFormat() { |
| | 72 | + if ( !$this->getUseDynamicDates() ) { |
| | 73 | + throw new MWException( 'Getting DateFormat option without UseDynamicDates.' ); |
| | 74 | + } |
| | 75 | + |
| 70 | 76 | if ( !isset( $this->mDateFormat ) ) { |
| 71 | 77 | $this->mDateFormat = $this->mUser->getDatePreference(); |
| 72 | 78 | } |
| — | — | @@ -101,6 +107,8 @@ |
| 102 | 108 | function setTimestamp( $x ) { return wfSetVar( $this->mTimestamp, $x ); } |
| 103 | 109 | function setCleanSignatures( $x ) { return wfSetVar( $this->mCleanSignatures, $x ); } |
| 104 | 110 | function setExternalLinkTarget( $x ) { return wfSetVar( $this->mExternalLinkTarget, $x ); } |
| | 111 | + function setMath( $x ) { return wfSetVar( $this->mMath, $x ); } |
| | 112 | + |
| 105 | 113 | function setIsPreview( $x ) { return wfSetVar( $this->mIsPreview, $x ); } |
| 106 | 114 | function setIsSectionPreview( $x ) { return wfSetVar( $this->mIsSectionPreview, $x ); } |
| 107 | 115 | function setIsPrintable( $x ) { return wfSetVar( $this->mIsPrintable, $x ); } |
| — | — | @@ -163,6 +171,8 @@ |
| 164 | 172 | $this->mEnableLimitReport = false; |
| 165 | 173 | $this->mCleanSignatures = $wgCleanSignatures; |
| 166 | 174 | $this->mExternalLinkTarget = $wgExternalLinkTarget; |
| | 175 | + $this->mMath = $user->getOption( 'math' ); |
| | 176 | + |
| 167 | 177 | $this->mIsPreview = false; |
| 168 | 178 | $this->mIsSectionPreview = false; |
| 169 | 179 | $this->mIsPrintable = false; |
| Index: trunk/phase3/includes/Math.php |
| — | — | @@ -324,10 +324,10 @@ |
| 325 | 325 | .'/'. substr($this->hash, 2, 1); |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | | - public static function renderMath( $tex, $params=array() ) { |
| 329 | | - global $wgUser; |
| | 328 | + public static function renderMath( $tex, $params=array(), ParserOptions $parserOptions = null ) { |
| 330 | 329 | $math = new MathRenderer( $tex, $params ); |
| 331 | | - $math->setOutputMode( $wgUser->getOption('math')); |
| | 330 | + if ( $parserOptions ) |
| | 331 | + $math->setOutputMode( $parserOptions->getMath() ); |
| 332 | 332 | return $math->render(); |
| 333 | 333 | } |
| 334 | 334 | } |