Jump to content

Topic on Extension talk:Favorites/Flow

UNIQ...QINU parser problem

5
Subfader (talkcontribs)

In FavParser.php I try to return different output for certain namespace. For one namespace I have to pass the title to a template:

$list .= wfMsgExt( 'templateName', array( 'parseinline' ), $title );

The problem is that the same parser is used twice then. Solutions are offered here: QINU fix. But I don't know hot to apply it to FavParser.php. It seems to be the solution using

function exampleExtension( $input, $argv, &$parser ) {
	# do some stuff

	$output = $parser->parse(
		$stuff_to_parse, $parser->mTitle,
		$parser->mOptions, true, false
	);
	return $output->getText();
}

Could you have a look please?

Jlemley (talkcontribs)

Interesting. I'm not familiar with the QINU issues. The Favorites code calls FavParser from SpecialFavoritelist. $wgOut is used several times in that code. It will take a bit of time and research to figure out how to clean this up.

Jlemley (talkcontribs)

Ok, this is an extremely roundabout and horrible way to do this, but here's something to try:

$localparser = new Parser();
$parseroptions = new ParserOptions();
$list .= $localparser->parse(
   wfMessage( 'templateName', $title->getEscapedText() )->text(),
   $title,$parseroptions)->mText;

If you don't want the full namespace and title in there, then change $title->getEscapedText() to $title->getText()

I just could not find a better method without either incurring the wrath of the QINU monster, or completely ignoring any markup that is in the message. By the way, if you don't care about wiki markup (like bold), then just do this:

$list .= wfMessage( 'templateName', $title->getEscapedText())->text();

It's not a real fix, but I hope this helps with what you are trying to accomplish.

Subfader (talkcontribs)

Thanks, wfMessage seems to be 1.17+ or 1.18+. With wfMsgExt in 1.16 I get "Fatal error: Call to a member function text() on a non-object". Seems to work in 1.18, at least the QINU error is indeed gone. Thanks again!

65.41.147.195 (talkcontribs)

Yeah, sorry, I forgot to mention I was working in 1.17 at the time. I did not test anything in 1.16.

Reply to "UNIQ...QINU parser problem"