[Mediawiki-l] How to modify text to create footer-- ParserBeforeStrip overdoes it

Kelly Jones kelly.terry.jones at gmail.com
Fri May 18 00:48:18 UTC 2007


I'm writing a Mediawiki extension (http://mediawiki.pastey.net/28186)
that changes text like "[[X::R::Y]]" to "[[Y]]", and then displays X
and R at the bottom the page in a clever way (it's a semantic/RDF
extension, because I'm not crazy about the existing Semantic
Mediawiki).

To do this, I did:

$wgHooks['ParserBeforeStrip'][] = 'myInternalParseBeforeLinks';

where myInternalParseBeforeLinks(&$parser, &$text) appends "foo" to $text.

This works great for the main article, but "foo" also gets appended to
my page footer:

#  This page was last modified 16:57, 6 May 2007.
This page has been accessed 56 times.
{whatever "foo" I added appears here too}

When I create or edit a page, it's even worse: "foo" appears all over
the place.

How do I get my hook to JUST add "foo" to the main article and nothing
else? As you can tell from the hook name, I originally tried to add
this as a InternalParseBeforeLinks hook, but that didn't work either.

Are these the correct lists to ask on?

-- 
We're just a Bunch Of Regular Guys, a collective group that's trying
to understand and assimilate technology. We feel that resistance to
new ideas and technology is unwise and ultimately futile.



More information about the MediaWiki-l mailing list