[Mediawiki-l] problem:extension within templates

andres andres at holzapfel.ch
Fri Sep 9 12:30:05 UTC 2005


i wrote a extension to embed gallery2 images into mediawiki 1.5.
Everything works fine, except one thing:
included templates were not parsed the same way as normal pages.

To explain:
I include a new tag like [[foto:1234]]

and the extensions works like this:
$wgExtensionFunctions[] = 'registerHook';
function registerHook(){  ... $wgHooks['ParserBeforeStrip'][] = 
'replaceR'; }
function replaceR(&$article, $&text){ $text = preg_replace_callback([[]] 
into <img src='' />... , $text ); }

Templates are already stripped before entering 'ParserBeforeStrip', so i 
get no chance to replace 'before'.
The [[Foto:1234]] were already transformed into <a 
href='/Foto:1234'>Foto:1234</a>

to see the problem:
http://www.transarte.net/mediawiki/index.php/Diskussion:Gallery2wiki

Andres Obrero



More information about the MediaWiki-l mailing list