Last modified: 2013-06-19 20:02:23 UTC
Currently it is not easily to affect content rending with hooks, because the hooks that are available also modify the content in a way that shows up in diffs, pre-fillings of MediaWiki namespace pages and what else.
This issue blocks the resolved bug 28301. Does this mean this issue should be closed/wfm now because it was resolved without us paying attention?
Could this be considered equivalent to the question of how to properly hook article content pre-parse wikitext? http://www.mediawiki.org/wiki/Manual_talk:Hooks/ParserBeforeStrip#Detect_Parse_of_Article_Content_.2F_Hack_removal If so, adding metadata, perhaps to $parser->getOptions() that let you know what the item you were parsing was, (not the title of the page the item is found on) would go a long way to making ParseBeforeStrip more useful.
There are multiple problems with this, some of which I gave in the description.
The ArticleAfterFetchContent is not bad, http://www.mediawiki.org/wiki/Manual:Hooks/ArticleAfterFetchContent it gives you a $article and $content before wikitext is parsed. You can use $article->getContext()->getRequest->getVal('action', 'view') to then determine how the content will be used. I've havent checked every type (diffs for examples) but you may be able to differentiate between those and a standard viewing.
No I don't want to change the content, I want to change the display of the content, and only normal page views.
That's what I'm talking about. If you hook ArticleAfterFetchContent and check that 'action' === ('view' || 'purge' || 'print') you only change the display. True you have to change the cached display (you can invalidate the cache), but you can't win at everything. Of course a better hook that gets called every time would be nice (but provide a bigger performance impact). Or a hook where we don't have to constantly tweak for the types of display/export MW is doing.
That's exactly the point, I don't want to do any action === foobarbaz checks and update the list all the time. I also don't want affect the content, because if user edits it will mess up saves.
I wonder if this is now easily possible with ContentHandler?