AW: [Mediawiki-l] Parsing wiki test in an extension
Heli Retzek
helmut.retzek at asak.at
Mon Dec 6 13:25:53 UTC 2004
> I don't know if this is correct or even supposed to work but I've gotten
> my extension to work (i.e. process wiki text) using the following:
>
> function myExtension($input) {
> global $wgParser;
> //So some work and assign the result to $output
> $output = $wgParser->internalParse($output, true);
> return $output;
> }
---
Well, in my case - I tried an extension that allows certain formatting
(including color) your solution breaks part of the style-command (the
Fontsize is ignored, though simple style-tags are processed).
<?php
$wgExtensionFunctions[] = "wfH1Ext";
function wfH1Ext() {
global $wgParser;
$wgParser->setHook( "HR1", "HR1Formatter" );
}
// The callback function for converting the input text to HTML output
function HR1Formatter( $input )
{global $wgParser;
$output = "<div
style='font-size:300%;color:#FFA500;background-color:#F8F8FF;
align:center;'><b>".$input."</b></div>";
//$output = $wgParser->internalParse($output, true);
return $output;
}
?>
More information about the MediaWiki-l
mailing list