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 created this task.May 7 2018, 2:28 PM
daniel triaged this task as Normal priority.

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.

Ladsgroup moved this task from incoming to monitoring on the Wikidata board.Jun 28 2018, 3:39 PM
Vvjjkkii renamed this task from Introduce RevisionRenderer to 3gdaaaaaaa.Jul 1 2018, 1:12 AM
Vvjjkkii raised the priority of this task from Normal to High.
Vvjjkkii removed Tgr as the assignee of this task.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii edited subscribers, added: Tgr; removed: Aklapper, gerritbot.
CommunityTechBot assigned this task to Tgr.
CommunityTechBot lowered the priority of this task from High to Normal.
CommunityTechBot renamed this task from 3gdaaaaaaa to Introduce RevisionRenderer.
CommunityTechBot edited subscribers, added: Aklapper, gerritbot; removed: Tgr.
daniel updated the task description. (Show Details)Aug 1 2018, 3:52 PM
daniel renamed this task from Introduce RevisionRenderer to Introduce RevisionRenderer (baseline).
daniel updated the task description. (Show Details)Aug 1 2018, 4:07 PM
daniel updated the task description. (Show Details)Aug 1 2018, 4:14 PM

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

Tgr added a comment.EditedAug 30 2018, 12:10 PM

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

Tgr closed this task as Resolved.Aug 31 2018, 11:33 AM

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

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