Author: wikipedia
Description:
If I write an extension that return somewhat complex output like this:
$wgExtensionFunctions[] = "wfExampleExtension";
function wfExampleExtension() {
global $wgParser; # register the extension with the WikiText parser # the first parameter is the name of the new tag. In this case it defines
the tag <example> ... </example>
- the second parameter is the callback function for processing the text
between the tags
$wgParser->setHook( "example", "renderExample" );
}
- The callback function for converting the input text to HTML output function renderExample( $input ) {
$output = <<<EOT
<script type="text/javascript">
var wa = 'Wikipedia Rocks'; function showWA() { alert(wa); }
</script>
<div>
$input
</div>
EOT;
return $output;
}
I get the following output:
</p><p> <script type="text/javascript">
</p><p> var wa = 'Wikipedia Rocks';
</p><p> function showWA() {
</p><p> alert(wa);
</p><p> }
</p><p> </script>
</p>
<div>
<p> Hi There
</p>
</div>
Version: 1.5.x
Severity: normal