Page MenuHomePhabricator

In remarkup, strip one leading space from each line in a quoted block if possible
ClosedPublic

Authored by epriestley on Mar 26 2019, 8:40 PM.
Tags
None
Referenced Files
F13086067: D20327.diff
Thu, Apr 25, 12:03 AM
Unknown Object (File)
Wed, Apr 24, 12:51 PM
Unknown Object (File)
Sun, Apr 21, 6:49 PM
Unknown Object (File)
Sat, Apr 20, 4:41 PM
Unknown Object (File)
Thu, Apr 11, 8:20 AM
Unknown Object (File)
Fri, Apr 5, 10:34 PM
Unknown Object (File)
Wed, Apr 3, 11:24 PM
Unknown Object (File)
Wed, Apr 3, 11:24 PM
Subscribers
None
Tokens
"Orange Medal" token, awarded by Krinkle.

Details

Summary

Fixes T13268. Currently, when we quote text, we add > (with a space) but don't try to strip it when un-quoting text.

Instead, try to strip it.

We can still end up with some occasional weird cases (users manually typing ">") that we may have to refine eventually, but this should make the common case ("Quote" button in the UI) work more consistently.

Test Plan

Added a test, made it pass.

Screen Shot 2019-03-26 at 1.37.43 PM.png (595×378 px, 22 KB)

Diff Detail

Repository
rPHU libphutil
Branch
remarkup1
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 22389
Build 30629: Run Core Tests
Build 30628: arc lint + arc unit

Event Timeline

src/markup/engine/__tests__/remarkup/del.txt
1

This is quite a test case.

amckinley added inline comments.
src/markup/engine/remarkup/blockrule/PhutilRemarkupQuotesBlockRule.php
27–31

We don't want to just keep doing this whole process in a loop until it's no longer true?

This revision is now accepted and ready to land.Mar 26 2019, 9:02 PM

We would, except that a two space indent creates a code block. So if you type this:

__abcd

...you get this:

abcd

That quotes as:

>   abcd

With 3 spaces.

This change strips it to 2 spaces so it still works, but if we strip all spaces it'll un-code-block it.

I thought there was a test case for that already (quoted-code-block.txt) but that actually just tests a triple-backtick version. I'll add a space-to-indent version.

  • Add an explicit test case for >, three spaces, then text (which should be a code block).
This revision was automatically updated to reflect the committed changes.