Page MenuHomePhabricator

Make the "Reply" and "Quote" Remarkup rules more similar
ClosedPublic

Authored by epriestley on Apr 10 2019, 8:07 PM.

Details

Summary

Previously, see D20327. The "Reply" and "Quote" remarkup rules currently have some copy/pastey-feeling code, and the "Reply" rule wasn't touched by D20327.

The difference is that a reply starts with >>! In X, Y wrote:, although the attribution line is freeform text.

Make them both subclasses of a quoted-thing rule and push as much logic as possible up into the base class.

Test Plan

Added a unit test, made it pass. Existing tests all still pass, except for minor adjustments which look like improvements to me.

Diff Detail

Repository
rPHU libphutil
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

epriestley created this revision.Apr 10 2019, 8:07 PM
epriestley requested review of this revision.Apr 10 2019, 8:07 PM
epriestley added inline comments.Apr 10 2019, 8:09 PM
src/markup/engine/__tests__/remarkup/quoted-lists.txt
21–23

Oh, this and the one above are also behavioral: no more trailing whitespace.

src/markup/engine/__tests__/remarkup/quoted-quote.txt
2–5

This is the thing I'm trying to fix.

The version with no >>! was fixed by D20327, but this version didn't get touched because of the copy-pasteyness.

src/markup/engine/__tests__/remarkup/reply-basic.txt
12

Behavioral change: removal of extra empty newline. But seems like an improvement (more faithful to the input).

src/markup/engine/__tests__/remarkup/reply-nested.txt
44–48

Behavioral changes, but this output is more faithful to the input.

amckinley accepted this revision.Apr 11 2019, 5:38 PM

I confess to skimming this because it's mostly code shuffling and also includes a convincing unit test.

This revision is now accepted and ready to land.Apr 11 2019, 5:38 PM
This revision was automatically updated to reflect the committed changes.