Author: andres
Description:
to make the problem a bit clearer i wrote a small php script (see code below)
add it into LocalSettings.php as usual and write one page [ [ template:sample ]
] with the content
'abc'
and one page [ [ sample ] ] with the content
abc and { { sample } }
which should include template:sample.
the result is:
#ParserBeforeStrip[0]#*ParserAfterStrip[1]*%ParserBeforeTidy[2]%@ParserAfterTidy[3]@abc@@%%**##
%ParserBeforeTidy[2]%@ParserAfterTidy[3]@abc@@%%
Both lines should be identical.
The interpretation of the result is, that a template does not pass
'ParserBeforeStrip' and 'ParserAfterStrip' or ignore the modifications somehow
(&$ problem?).
Here the sample extension: (don't forget LocalSettings.php)
<?php
define ("_PATT_", "abc");
$wgExtensionFunctions[] = 'myTestHook';
$my=0;
function myTestHook(){
global $wgHooks; global $wgParser; $wgHooks['ParserBeforeStrip'][]= 'pbs'; $wgHooks['ParserAfterStrip'][] = 'pas'; $wgHooks['ParserBeforeTidy'][] = 'pbt'; $wgHooks['ParserAfterTidy'][] = 'pat';
}
function pbs(&$article, &$text, &$strip_state){ global $my;
$text = preg_replace("/("._PATT_.")/i",
"#ParserBeforeStrip[".($my++)."]#$1##" , $text );
}
function pas(&$article, &$text, &$strip_state){ global $my;
$text = preg_replace("/("._PATT_.")/i", "*ParserAfterStrip[".($my++)."]*$1**"
, $text );
}
function pbt(&$article, &$text){ global $my;
$text = preg_replace("/("._PATT_.")/i", "%ParserBeforeTidy[".($my++)."]%$1%%"
, $text );
}
function pat(&$article, &$text){ global $my;
$text = preg_replace("/("._PATT_.")/i", "@ParserAfterTidy[".($my++)."]@$1@@"
, $text );
}
?>
Version: 1.5.x
Severity: major
OS: Windows XP
Platform: PC