Mailing List Archive

Parsing wiki test in an extension
I'm writing an extension and so far everything is going fine except that
my extension produces wiki text and that is not parsed but included
as-is into the wiki.

I really need to figure out a way to get this text parsed as it includes
links to other pages, and in some cases the linked-to pages don't exist
yet so having the links in a different colour is very useful.

Is there a simple to way to have my text parsed? Or at the very least
have the links parsed?

I've tried invoking Parser.php myself on the output I produce but
results in errors, usually of the sort "Call to a member function on a
non-object ".

Any help is greatly appreciated!

Jc

PS disregard the disclaimer. I'm waiting for the day this mailing list
is also gated as a google newsgroup :)
Note: This e-mail contains privileged and confidential information and is for the sole use of the intended recipient(s). If you are not an intended recipient, you are hereby kindly requested to refrain from printing, copying, or distributing the information contained herein. Furthermore, any other use of the information contained herein is strictly prohibited. If you have received this transmission in error, please kindly notify the sender immediately and destroy all copies of the original message.
Re: Parsing wiki test in an extension [ In reply to ]
I don't know if this is correct or even supposed to work but I've gotten
my extension to work (i.e. process wiki text) using the following:

function myExtension($input) {
global $wgParser;
//So some work and assign the result to $output
$output = $wgParser->internalParse($output, true);
return $output;
}

Jc

==Nasty disclaimer follows==

Note: This e-mail contains privileged and confidential information and is for the sole use of the intended recipient(s). If you are not an intended recipient, you are hereby kindly requested to refrain from printing, copying, or distributing the information contained herein. Furthermore, any other use of the information contained herein is strictly prohibited. If you have received this transmission in error, please kindly notify the sender immediately and destroy all copies of the original message.
AW: Parsing wiki test in an extension [ In reply to ]
did you test the speed, is there a significant delay - maybe the procedures
call itselfs recoursivly? (does $wgParser->internalParse($output, true);
call again your extension?)

xx HeliR

>
> I don't know if this is correct or even supposed to work but I've gotten
> my extension to work (i.e. process wiki text) using the following:
>
> function myExtension($input) {
> global $wgParser;
> //So some work and assign the result to $output
> $output = $wgParser->internalParse($output, true);
> return $output;
> }
>
AW: Parsing wiki test in an extension [ In reply to ]
> I don't know if this is correct or even supposed to work but I've gotten
> my extension to work (i.e. process wiki text) using the following:
>
> function myExtension($input) {
> global $wgParser;
> //So some work and assign the result to $output
> $output = $wgParser->internalParse($output, true);
> return $output;
> }

---


Well, in my case - I tried an extension that allows certain formatting
(including color) your solution breaks part of the style-command (the
Fontsize is ignored, though simple style-tags are processed).


<?php
$wgExtensionFunctions[] = "wfH1Ext";

function wfH1Ext() {
global $wgParser;
$wgParser->setHook( "HR1", "HR1Formatter" );
}


// The callback function for converting the input text to HTML output
function HR1Formatter( $input )
{global $wgParser;

$output = "<div
style='font-size:300%;color:#FFA500;background-color:#F8F8FF;
align:center;'><b>".$input."</b></div>";
//$output = $wgParser->internalParse($output, true);
return $output;
}
?>
RE: Parsing wiki test in an extension [ In reply to ]
> -----Original Message-----
> From: mediawiki-l-bounces@Wikimedia.org [mailto:mediawiki-l-
>
>
> > I don't know if this is correct or even supposed to work but I've gotten
> > my extension to work (i.e. process wiki text) using the following:
> >
> > function myExtension($input) {
> > global $wgParser;
> > //So some work and assign the result to $output
> > $output = $wgParser->internalParse($output, true);
> > return $output;
> > }
>
> ---

This hack above seems to work i.e. I get $input parsed when I put wikitext
within a custom tag. I wonder if it's going to break something else
somewhere.