r57997 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r57996‎ | r57997 | r57998 >
Date:11:40, 22 October 2009
Author:demon
Status:resolved (Comments)
Tags:
Comment:
(bug 21222) Free <math> tag if not using it. Patch by Platonides.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/parser/Parser.php
@@ -3282,8 +3282,11 @@
32833283 $output = Xml::escapeTagsOnly( $content );
32843284 break;
32853285 case 'math':
3286 - $output = $wgContLang->armourMath(
3287 - MathRenderer::renderMath( $content, $attributes ) );
 3286+ if ( $this->mOptions->getUseTeX() ) {
 3287+ $output = $wgContLang->armourMath(
 3288+ MathRenderer::renderMath( $content, $attributes ) );
 3289+ }
 3290+ /* else let a tag hook handle it (bug 21222) */
32883291 break;
32893292 case 'gallery':
32903293 $output = $this->renderImageGallery( $content, $attributes );
Index: trunk/phase3/RELEASE-NOTES
@@ -254,6 +254,8 @@
255255 reuploading.
256256 * Added $wgRateLimitsExcludedIPs, to allow specific IPs to be whitelisted from
257257 rate limits.
 258+* (bug 21222) When $wgUseTeX is not enabled, <math> is no longer registered with
 259+ the parser so extensions are free to implement their own <math> tag
258260
259261 === Bug fixes in 1.16 ===
260262

Follow-up revisions

RevisionCommit summaryAuthorDate
r58040Fix r57997 and r58039 for realz this timedemon22:07, 22 October 2009
r61913* Fix for r57997 and bug 21222: move math, gallery, pre and nowiki to a new m...tstarling07:10, 3 February 2010

Comments

#Comment by Platonides (talk | contribs)   16:14, 22 October 2009

That's not the patch I provided.

In my patch, if TeX was disabled, you passed to the default case (the comment marks the point where the break is purposefully omitted) You're doing a NO-OP for math, so $this->mTagHooks won't be called.

http://bug-attachment.wikimedia.org/attachment.cgi?id=6697


#Comment by 😂 (talk | contribs)   16:17, 22 October 2009

Blah, I see where I botched that. I moved the break thinking it should've no-opped. If I'd read a few more lines down I would've caught that.

Will fix this evening if nobody beats me to it.

#Comment by 😂 (talk | contribs)   22:02, 22 October 2009

Fixed in r58039

#Comment by Tim Starling (talk | contribs)   02:38, 17 December 2009

It would be more elegant to turn gallery and math into normal tag hooks, like what we do with core parser functions. Then they would be overridable just by calling setHook() any time after firstCallInit() registers them. Math should also be split out to an extension, although that's more complex and can wait until later if necessary.

#Comment by Tim Starling (talk | contribs)   07:15, 3 February 2010

Marking resolved, please review r61913.

Status & tagging log