Last modified: 2013-06-19 20:02:23 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 28302 - Provide a way to easily affect content rendering
Provide a way to easily affect content rendering
Status: NEW
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
1.18.x
All All
: Normal normal with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks: 28301
  Show dependency treegraph
 
Reported: 2011-03-29 08:25 UTC by Niklas Laxström
Modified: 2013-06-19 20:02 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Niklas Laxström 2011-03-29 08:25:35 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.
Comment 1 Siebrand Mazeland 2011-08-02 12:09:48 UTC
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?
Comment 2 Olivier Finlay Beaton 2011-09-28 15:32:24 UTC
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.
Comment 3 Niklas Laxström 2011-09-28 16:53:03 UTC
There are multiple problems with this, some of which I gave in the description.
Comment 4 Olivier Finlay Beaton 2011-09-30 00:08:09 UTC
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.
Comment 5 Niklas Laxström 2011-09-30 05:34:24 UTC
No I don't want to change the content, I want to change the display of the content, and only normal page views.
Comment 6 Olivier Finlay Beaton 2011-09-30 12:46:55 UTC
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.
Comment 7 Niklas Laxström 2011-09-30 17:11:27 UTC
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.
Comment 8 Niklas Laxström 2013-06-16 20:59:16 UTC
I wonder if this is now easily possible with ContentHandler?

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links