errr... I mean how do I fix the code so it processes internal links?
On Fri, Aug 8, 2008 at 11:04 PM, Jonathan Nowacki jnowacki@gmail.comwrote:
I have a parser function that takes this:
{{#r8:http://www.holygrail.com Click Here To Search For The Grail!}}
and turns it into this link:
Click Here To Search For The Grail! http://www.holygrail.com/ -
However, what it won't do is make an internal link within the wiki.
For example this:
{{#r8:Main_Page Main Page}}
turns into this:
[Main_Page Main Page ] -
Any idea how to fix internal pages? Code shown below:
$wgExtensionFunctions[] = 'efExampleParserFunction_Setup';
# Add a hook to initialise the magic word $wgHooks['LanguageGetMagic'][] = 'efExampleParserFunction_Magic';
function efExampleParserFunction_Setup() { global $wgParser; # Set a function hook associating the "example" magic word with our function $wgParser->setFunctionHook( 'r8', 'efExampleParserFunction_Render' ); }
function efExampleParserFunction_Magic( &$magicWords, $langCode ) { # Add the magic word # The first array element is case sensitive, in this case it is not case sensitive # All remaining elements are synonyms for our parser function $magicWords['r8'] = array( 0, 'r8' ); # unless we return true, other parser functions extensions won't get loaded. return true; }
function efExampleParserFunction_Render( &$parser, $param1 = '', $param2 = '' ) { # The parser function itself # The input parameters are wikitext with templates expanded # The output should be wikitext too return "[$param1 $param2] - "; }
-- IU Medical School 410 West 10th Street, Suite 5000 Indianapolis, IN 46202-5122 United States of America