Flip,
The output of an extension tag is inserted back into the rendered text at a late stage of parsing. There is only minimal processing of wikitext left to do. Specifically:
* Leading spaces are processed as preformatted text (<pre>whatever</pre>) * Asterisks and pound symbols are processed as lists * The HTML is run through a Tidy-like filter
Your extension expects the full treatment, which isn't the case. Table processing has already occurred by the time your extension's output is injected into the text.
My suggestion is to alter your drawTable() method to do the parsing prior to return, like this:
function drawTable( $input, $argv, &$parser ) { // for now, ignore the text in between the tags. // let's use a user-assigned value for $input. $input = array( ... );
$output = buildWikiTable($input); $result = $parser->parse($output, $parser->mTitle, $parser->mOptions); return $result->getText(); }
-- Jim R. WIlson (jimbojw)
On 7/27/07, Flip Mozart flipmozart@yahoo.com wrote:
My next question is somewhat related to my earlier email on "Custom tag within a custom tag".
I tried writing a parser extension function which constructs a table using wikitext, like this:
{| | Country||Population |- | || ... |- |}
The code looks like this:
$wgExtensionFunctions[] = "wfXdataExtension";
function wfXdataExtension() { global $wgParser; $wgParser->setHook( "data", "drawTable" ); }
function drawTable( $input, $argv, &$parser ) { // for now, ignore the text in between the tags. // let's use a user-assigned value for $input. $input = array( ... );
$output = buildWikiTable($input);
return $output; }
I was EXPECTING this:
Sample article:
Country Population Germany 50,000,000 ...
But I got this instead:
{| | Country||Population |- | || ... |- |}
It seems that the Wiki treated the above AS IS, and did not interpret it as special WikiText that needs to be converted to (X)HTML.
My question is: How do I force the Wiki to evaluate the WikiText returned by my parser extension function?
Many thanks!
Filip
Send instant messages to your online friends http://uk.messenger.yahoo.com
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l