On Tue, 8 Mar 2005 13:30:31 -0500, suresh.k.kadirvel@gsk.com
But the current mediawiki parser wont parse the above template properly because it expects complete table syntax not pieces of it. I am wondering if there is any workaround or way out to achieve this ?
I don't think this is true. Certainly, viewing the template *by itself* won't produce anything useful, but I'm pretty sure the inclusion mechanism just shoves the text together, and that the "infoboxes" on en.wikipedia use exactly this kind of trick to allow optional rows etc.
I tested, and after creating a template (let's call it [[Template:Table row]]) with the 2 lines: |--- | {{{text}}}
I could create a page with something like this: {| border="1" ! Heading {{Table row|text=This is the first row}} {{Table row|text=This is the second row}} |}
And it would work fine.
With respect to your extension, note that the text returned by an extension is treated as *raw output* (i.e. HTML), *not wiki markup*. So to use the wiki table syntax in an extension, you'll have to call Parser::parse() on it directly.
According to a quick search of the list archives, Christof Damian wrote a function like this: function renderer($input) { global $wgTitle,$wgParser,$wgUser; $output = $wgParser->parse($cal->getCurrentMonthView(), $wgTitle, ParserOptions::newFromUser($wgUser)); return $o->getText(); }
While FxParlant (based on my untested assumptions) got this to work: global [...] $wgUser,$wgParser,$parserOptions,$wgTitle, $wgOut,$wgLinkCache; [ ... ] $wgLinkCache->suspend(); $parsed = $wgParser->parse( $mytext, $wgTitle, $wgOut->mParserOptions, true); $output .= $parsed->getText(); return $output;
It does look like some "quick" way of doing this within extensions would be nice, but it seems to be doable anyhow.
Please let me know if this is not the right place to post questions about mediawiki.
Well, mediawiki-l is preferred for topics unrelated to core development or the Wikimedia-family of websites, but I think more or less the same people read both anyway. I expect someone will complain they like to have them filtered seperately, but personally I shove them both in the same GMail 'label'.