[Mediawiki-l] Feature request for extensions...

Muzaffer Ozakca mozakca at indiana.edu
Thu Dec 16 17:55:36 UTC 2004


Hi,

I'm going to write a couple functions for a bunch of new tags. All tags will
call the same function: 

$wgParser->setHook( "tag1", "func" ); 
$wgParser->setHook( "tag2", "func" );
$wgParser->setHook( "tag3", "func" );
...

What do you say about passing the tag to the callback function?

So, instead of,
function func ( $input )

it could be,
function func ( $input, $tag )

so, a switch within the function can tell which tag caused the call. I
looked at the source code, Parser.php, it looks like a simple modification:

In the Parser.php, line 365 (ver 1.3.9) this:
$ext_content[$tag][$marker] = $callback( $content );

Can be changed to this:
$ext_content[$tag][$marker] = $callback( $content, $tag );

I already did this change on my code, I was wondering this could be
officially added to MediaWiki.

Just a suggestion to see if this would make life for some easier :)

Muzaffer




More information about the MediaWiki-l mailing list