[Mediawiki-l] extensions and wiki markup

Christof Damian christof at damian.net
Fri Jan 21 17:53:03 UTC 2005


I found a similar solution now, without using the internal function.

function renderer($input) {
  global $wgTitle,$wgParser,$wgUser;
  $output = $wgParser->parse($cal->getCurrentMonthView(), $wgTitle, ParserOptions::newFromUser($wgUser));
  return $o->getText();
}

but I still think there should be a way for extensions to use the parser without hacks like this. 

christof


On Fri, 21 Jan 2005, Muzaffer Ozakca wrote:
> The solution below was offered by a hacker on this list a couple months ago.
> 
> 
> function renderer( $input ) {
>         global $wgParser;
> 
> ...
> 
> 	  // pass $input to wiki parser
>         $output = $wgParser->internalParse($input, true);
> 
> ...
> 
>         return $output;
> }
> 
> I'm aware that it works for images. It probably works for other kinds of
> links, too. This might fail to work for some other things, though.
> 
> Using this occasion, I'd like to thank to the person who came up with this
> solution in the first place, Jean-Christian Imbeault. Saved me a lot of
> effort.
> 
> 
> > From: mediawiki-l-bounces at Wikimedia.org [mailto:mediawiki-l-
> > bounces at Wikimedia.org] On Behalf Of Christof Damian
> > Sent: Friday, January 21, 2005 10:41 AM
> > To: MediaWiki announcements and site admin list
> > Subject: [Mediawiki-l] extensions and wiki markup
> > 
> > Hello,
> > I wrote a tiny calendar extension for mediawiki to use it on my techno
> > wiki website. It works allright, but I would like to improve it.
> > 
> > I used the example from
> > http://meta.wikimedia.org/wiki/Write_your_own_MediaWiki_extension ,
> > which states "This function can then return a HTML string that gets
> > inserted into the output in place of the tags and text. Note that the
> > return string should be HTML, not wiki markup."
> > 
> > Is there any to implement extensions which can use wiki markup?
> > Currently I have to implement Links with class Title and Article,
> > basically reimplementing the [[link]] syntax and that doesn't even
> > work nice with all skins.
> > 
> > I also might want to use templates and images in the calendar output.
> > 
> > Or is there an easy way to parse a string and get an html in return.
> > 
> > Christof
> 
> 
> _______________________________________________
> MediaWiki-l mailing list
> MediaWiki-l at Wikimedia.org
> http://mail.wikipedia.org/mailman/listinfo/mediawiki-l

-- 
Christof Damian         
christof at damian.net



More information about the MediaWiki-l mailing list