Homec4science

Implement basic one-up and test renderers

Authored by epriestley <git@epriestley.com> on Jan 14 2013, 23:20.

Description

Implement basic one-up and test renderers

Summary:
This is a half-step toward one-up and test renderers. This is mostly a structural change, and has no user-facing impact. It splits the rendering hierarchy like this:

  • Renderer (more methods are abstract than before)
    • HTML Renderer (most HTML stuff has moved down from the base to here)
      • HTML 1-up (placeholder only -- not yet a functional implementation)
      • HTML 2-up (minimal changes, uses mostly old code)
    • Test Renderer (unit-testable renderer base, implements text versions of the HTML stuff)
      • Test 1-up (selects 1-up mode for test rendering)
      • Test 2-up (selects 2-up mode for test rendering)

Broadly, I'm trying to share as much code as possible by splitting rendering into more, smaller stages. Specifically, we do this:

  • Combine the various sorts of inputs (changes, context, inlines, etc.) into a single, relatively homogenous list of "primitives". This happens in the base class.
    • The primitive types are: old (diff left side), new (diff right side), context ("show more context"), no-context ("context not available") and inline (inline comment).
  • Possibly, apply a filtering/reordering step to the primitives to get them ready for 1-up rendering. This mostly removes information, and does a small amount of reordering. This also happens in the base class.
  • Pass the primitives to the actual renderer, to convert them into HTML, text, or whatever else. This happens in the leaf class.

The primitive implementation is not yet complete (it doesn't attach as much information to the primitives as it should -- stuff like coverage and copies), but covers the basics.

The existing HTMLTwoUp renderer does not use the primitive path; instead, it still goes down the old path.

Test Plan: Ran unit tests, looked at a bunch of diffs.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2009

Differential Revision: https://secure.phabricator.com/D4421

Details

Committed
epriestley <git@epriestley.com>Jan 14 2013, 23:20
Pushed
aubortJan 31 2017, 17:16
Parents
rPHff91884f7d81: Dark sidebar everywhere
Branches
Unknown
Tags
Unknown

Event Timeline

epriestley <git@epriestley.com> committed rPH612b29fff40a: Implement basic one-up and test renderers (authored by epriestley <git@epriestley.com>).Jan 14 2013, 23:20