r62416 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r62415‎ | r62416 | r62417 >
Date:02:22, 13 February 2010
Author:conrad
Status:reverted (Comments)
Tags:
Comment:
Deprecate old undocumented workaround to bug 2257 (setTransparentTagHook)
Modified paths:
  • /trunk/extensions/geoserver/geoserver.php (modified) (history)
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/parser/Parser.php
@@ -374,25 +374,26 @@
375375
376376 wfRunHooks( 'ParserBeforeTidy', array( &$this, &$text ) );
377377
378 -//!JF Move to its own function
 378+ if ( $this->mTransparentTagHooks ) {
 379+ //!JF Move to its own function
 380+ $uniq_prefix = $this->mUniqPrefix;
 381+ $matches = array();
 382+ $elements = array_keys( $this->mTransparentTagHooks );
 383+ $text = self::extractTagsAndParams( $elements, $text, $matches, $uniq_prefix );
379384
380 - $uniq_prefix = $this->mUniqPrefix;
381 - $matches = array();
382 - $elements = array_keys( $this->mTransparentTagHooks );
383 - $text = self::extractTagsAndParams( $elements, $text, $matches, $uniq_prefix );
384 -
385 - foreach( $matches as $marker => $data ) {
386 - list( $element, $content, $params, $tag ) = $data;
387 - $tagName = strtolower( $element );
388 - if( isset( $this->mTransparentTagHooks[$tagName] ) ) {
389 - $output = call_user_func_array( $this->mTransparentTagHooks[$tagName],
390 - array( $content, $params, $this ) );
391 - } else {
392 - $output = $tag;
 385+ foreach( $matches as $marker => $data ) {
 386+ list( $element, $content, $params, $tag ) = $data;
 387+ $tagName = strtolower( $element );
 388+ if( isset( $this->mTransparentTagHooks[$tagName] ) ) {
 389+ $output = call_user_func_array( $this->mTransparentTagHooks[$tagName],
 390+ array( $content, $params, $this ) );
 391+ } else {
 392+ $output = $tag;
 393+ }
 394+ $this->mStripState->general->setPair( $marker, $output );
393395 }
394 - $this->mStripState->general->setPair( $marker, $output );
 396+ $text = $this->mStripState->unstripGeneral( $text );
395397 }
396 - $text = $this->mStripState->unstripGeneral( $text );
397398
398399 $text = Sanitizer::normalizeCharReferences( $text );
399400
@@ -4243,7 +4244,9 @@
42444245 return $oldVal;
42454246 }
42464247
 4248+ /* An old work-around for bug 2257 - deprecated 2010-02-13 */
42474249 function setTransparentTagHook( $tag, $callback ) {
 4250+ wfDeprecated( __METHOD__ );
42484251 $tag = strtolower( $tag );
42494252 $oldVal = isset( $this->mTransparentTagHooks[$tag] ) ? $this->mTransparentTagHooks[$tag] : null;
42504253 $this->mTransparentTagHooks[$tag] = $callback;
Index: trunk/extensions/geoserver/geoserver.php
@@ -20,7 +20,7 @@
2121 */
2222 function wfGeoServerExtension () {
2323 global $wgParser, $wgHooks ;
24 - $wgParser->setTransparentTagHook ( 'geo' , 'parseGeo' ) ;
 24+ $wgParser->setHook ( 'geo' , 'parseGeo' ) ;
2525 # $wgHooks['ArticleSaveComplete'][] = 'articleDeleteGeo';
2626 $wgHooks['ArticleDelete'][] = 'articleDeleteGeo';
2727 $wgHooks['ArticleEditUpdatesDeleteFromRecentchanges'][] = 'articleSaveGeo';
@@ -36,8 +36,11 @@
3737 *
3838 * Return markup, but also a pointer to Map sources
3939 */
40 -function parseGeo ( $text, $params, &$parser ) {
 40+function parseGeo ( $text, $params, &$parser, &$frame ) {
4141 global $action, $GeoserverParameters, $wgWikiMapsJS;
 42+
 43+ $text = $parser->recursiveTagParse( $text, $frame );
 44+
4245 $latpat= '(-?[0-9.]*) *(([0-9.]+) *([0-9.]+)?)? *([NS])';
4346 $lonpat= '(-?[0-9.]*) *(([0-9.]+) *([0-9.]+)?)? *([EW])';
4447 $featcodepat = '(([AHLPRSTUV])\.([A-Z.]*))?';

Follow-up revisions

RevisionCommit summaryAuthorDate
r62434Fix for <poem> after r62416conrad14:41, 13 February 2010
r62689Moving Conrad's recent parser work out to a branch. Reverted r62434, r62416, ...tstarling05:19, 19 February 2010
r62690Reverted the extension part of r62416, core part was reverted in r62689.tstarling05:21, 19 February 2010
r64050Revert r62434 and r62416, not relevant to pipe trickconrad00:41, 23 March 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r55682(bug 2257) Add a $frame parameter to recursiveTagParse so tag extensions can ...nephele06:37, 30 August 2009

Comments

#Comment by Platonides (talk | contribs)   13:49, 13 February 2010

This breaks

Foo

, which now show the UNIQ--QINU codes.

See poem parsertests.

#Comment by Conrad.Irwin (talk | contribs)   14:46, 13 February 2010

<poem><nowiki>Foo

Bar</nowiki></poem>

was broken because the poem tag replaces newlines with hardened newlines before it looks at the wikitext inside which caused modification of the contents of a <nowiki> tag (which I assumed wouldn't happen)

Status & tagging log