Manual:Tag_extensions#How_can_I_avoid_modification_of_my_extension.
27s_HTML_output.3F
:-)
Boris
On 30-Dec-07, at 1:45 PM, Minute Electron wrote:
Hello,
Due to parser tags not being able to correctly handle variables such
as {{{1}}} I created my own custom parser function that calls a parser
tag I've installed so that I could use such variables with it.
Unfortunately instead of outputting the actual image that it should do
it outputs the code raw - I've verified this is something to do with
the parser as I have done some testing and can confirm that before it
is return-ed it is still HTML code, not escaped HTML code. Below is a
copy of my custom code for anyone who is interested in helping. Any
assistance would be greatly appreciated.
<?php
/* Parser Function style work around, calls above function. */
$wgExtensionFunctions[] = 'wfImageLinkWorkAroundParserFunction_Setup';
$wgHooks['LanguageGetMagic'][] =
'wfImageLinkWorkAroundParserFunction_Magic';
function wfImageLinkWorkAroundParserFunction_Setup() {
global $wgParser;
$wgParser->setFunctionHook( 'link',
'wfImageLinkWorkAroundParserFunction_Render' );
}
function wfImageLinkWorkAroundParserFunction_Magic( &$magicWords,
$langCode ) {
$magicWords[ 'link' ] = array( 0, 'link' );
return true;
}
function wfImageLinkWorkAroundParserFunction_Render( &$parser, $target
= '', $alt = "", $src = "", $height = "", $width =
"" ) {
$img = new LinkedImage;
$img->wikipage = $target;
$img->tooltip = $alt;
$img->img_src = $src;
$img->img_alt = $alt;
$img->img_height = $height;
$img->img_width = $width;
$img->img_border = 0;
#echo $img->render(); # Outputs actual HTML (e.g. <img src="foo" />)
return $img->render(); #' Outputs escaped HTML (e.g. <img
src="foo" />)
}
?>
--
MinuteElectron.
http://my.brlcad.org/~MinuteElectron/
_______________________________________________
MediaWiki-l mailing list
MediaWiki-l(a)lists.wikimedia.org
http://lists.wikimedia.org/mailman/listinfo/mediawiki-l