[Mediawiki-l] Multiple stages of parsing (or forced re-conversion of wikitext into XHTML)

Flip Mozart flipmozart at yahoo.com
Fri Jul 27 11:40:05 UTC 2007


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 



More information about the MediaWiki-l mailing list