Page MenuHomePhabricator

Introduce RevisionRenderer (baseline)
Closed, ResolvedPublic

Description

RevisionRenderer is a stateless service for generating a ParserOutput object for a given RevisionRecord. The output should combine all slots.

The service should eventually also support single-slot mode, user-specific vs canonical rendering, and previews. In a first iteration, it only needs to support one method:

  • renderRevision( RevisionRecord $revRec, ParserOptions $options ): RenderedRevison;

RenderedRevision would in turn support at least:

  • getCombinedParserOutput()
  • getRevision()
  • maybe also getSlotParserOutput( $role ).

All ParserOutputs should be cached locally. The ParserOptions to be used would be injected into the constructor of RenderedRevision by RevisionRenderer::renderRevision().

For the first version, it's sufficient for getCombinedParserOutput to concatenate the output for all slots, with the main slot going first, possibly with a heading for all but the main slot.

In later iterations, SlotRoleHandlers should provide layout hints that can cause the output for some slots to be placed differently.

NOTE: One seemingly trivial aspect of this that should not be underestimated is the need for code that merges one ParserOutput into another.

Event Timeline

daniel triaged this task as Medium priority.May 7 2018, 2:28 PM
daniel created this task.

Change 421794 had a related patch set uploaded (by Daniel Kinzler; owner: Daniel Kinzler):
[mediawiki/core@master] [MCR][WIP] Intropduce RevisionRenderer

https://gerrit.wikimedia.org/r/421794

Dropping from MCR-SDC phase 1 to phase 2, because WikibaseMediaInfo already has a mechanism for displaying the content on the file description page.

Vvjjkkii renamed this task from Introduce RevisionRenderer to 3gdaaaaaaa.Jul 1 2018, 1:12 AM
Vvjjkkii removed Tgr as the assignee of this task.
Vvjjkkii raised the priority of this task from Medium to High.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii edited subscribers, added: Tgr; removed: Aklapper, gerritbot.
CommunityTechBot renamed this task from 3gdaaaaaaa to Introduce RevisionRenderer.Jul 2 2018, 6:38 AM
CommunityTechBot assigned this task to Tgr.
CommunityTechBot lowered the priority of this task from High to Medium.
CommunityTechBot updated the task description. (Show Details)
CommunityTechBot edited subscribers, added: Aklapper, gerritbot; removed: Tgr.
daniel renamed this task from Introduce RevisionRenderer to Introduce RevisionRenderer (baseline).Aug 1 2018, 3:52 PM
daniel updated the task description. (Show Details)

Change 451025 had a related patch set uploaded (by Daniel Kinzler; owner: Daniel Kinzler):
[mediawiki/core@master] [MCR] Introduce RevisionRenderer

https://gerrit.wikimedia.org/r/451025

Change 452567 had a related patch set uploaded (by Daniel Kinzler; owner: Daniel Kinzler):
[mediawiki/core@master] Make HTML generation in RenderedRevision optional

https://gerrit.wikimedia.org/r/452567

Change 421794 abandoned by Daniel Kinzler:
[MCR][WIP] Intropduce RevisionRenderer

Reason:
See I871978bf79f67c9e7954fb3fc8528d6e365f2cc1 instead

https://gerrit.wikimedia.org/r/421794

Test plan:

  • do multi-slot edit (from shell), muti-slot page creation (from shell), null edit, null revision (page move)
    • test REVISION* magic words
    • verify slot headers
    • test metadata merge - for now just with a single-slot edit since we won't have nontrivial metadata in non-main slots for a while and testing programatically is lots more effort. Lots of things to potentially test here, but probably the important ones are:
      • TOC
      • ResourceLoader modules
      • JS variables
      • DISPLAYTITLE
      • link tables
      • (edit warnings, but those can only be tested on preview)
  • test getRevisionParserOutput( [ 'generate-html' => false ] ) from shell
  • test article count changes during an edit

In the future (once editing/saving multi-slot revisions becomes possible) most of these things should be tested for viewing old revisions, deleted/suppressed revisions, preview, stash edit as well. Also some PreparedEdit extension (e.g. check AbuseFilter variables).

Change 451025 merged by jenkins-bot:
[mediawiki/core@master] [MCR] Introduce RevisionRenderer

https://gerrit.wikimedia.org/r/451025

Change 452567 merged by jenkins-bot:
[mediawiki/core@master] Make HTML generation in RenderedRevision optional

https://gerrit.wikimedia.org/r/452567