[Mediawiki-l] embedding extensions

aretai aretai aretaiuc at gmail.com
Mon Mar 12 16:57:10 UTC 2007


Hi,

Does anyone has an idea how to embed an extension in another one? For
example I have a simple extension:

<?php
 $wgExtensionFunctions[] = "wfLCExtension";

 function wfLCExtension() {
     global $wgParser;
     # register the extension with the WikiText parser
     # the first parameter is the name of the new tag.
     # In this case it defines the tag <mlc> ... </mlc>
     # the second parameter is the callback function for
     # processing the text between the tags
     $wgParser->setHook( "mlc", "rendercontent" );
 }

 # The callback function for converting the input text to HTML output
 function rendercontent( $input, $argv, &$parser ) {
    $link = '';
    $linking = '';
    $localParser = new Parser();
    $linking = $localParser->parse($input, $parser->mTitle,
$parser->mOptions);
    $link .= $linking->getText();
    return $link;
 }
 ?>

It just returns the text put between the <mlc></mlc> tags. I use it to mark
this section while the article is being imported to xml (which I use
further).

The problem is that I'd like make it possible for users to add different
content between these tags (including other extensions). For example:

http://meta.wikimedia.org/wiki/Google_extension

but instead of properly rendered content I get sth like:

standard content
<google></google>
standard content

thx in advance,

Regards,
Aretai


More information about the MediaWiki-l mailing list