HomePhabricator

Adding a bunch of hooks from wikiHow into DifferenceEngine, 2nd try

Tags
None
Referenced Files
None
Subscribers
None

Description

Adding a bunch of hooks from wikiHow into DifferenceEngine, 2nd try

Now with less fatals and more functionality! At least I sure hope so.

Unlike the first time around (https://gerrit.wikimedia.org/r/206642), the
DifferenceEngineRenderRevisionAddParserOutput and
DifferenceEngineShowEmptyOldContent hooks now only affect things if a
hooked function returns false. Since by default nothing is hooked into
these brand new hooks, the behavior should stay exactly the same as before
this patch and things like bug T139435 shouldn't happen anymore.

These hooks allow things such as:

  • adding CSS(/JS) into the OutputPage when viewing diffs
  • adding extra HTML content (such as avatars) into diff views
  • hiding the bottom "mark as patrolled" link
  • altering the parser output that is used by DifferenceEngine
  • and more

Example extension using these hooks is wikiHow's
/extensions/wikihow/hooks/, specifically the file DiffHooks.php (but the
hooks are setup in WikihowHooks.php).

Live example of the DiffHooks stuff in action can be found at wikiHow.com,
for example:
http://www.wikihow.com/index.php?title=Set-Your-Homepage&diff=17112892&oldid=15888129
(user avatars, additional CSS, changes to the old/new revision header
texts/links)

Bug: T139526
Change-Id: I10293be4581140c3edf0e4b538b04b31cb6f5730

Details

Provenance
ashleyAuthored on Jul 8 2016, 4:46 PM
Parents
rMW507a6aece270: New parserTests.php features
Branches
Unknown
Tags
Unknown
ChangeId
I10293be4581140c3edf0e4b538b04b31cb6f5730

Event Timeline