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
F15453291: D20327.diff
Sat, Mar 29, 10:44 AM
F15431223: D20327.id48518.diff
Mon, Mar 24, 11:12 AM
F15424617: D20327.id48518.diff
Sat, Mar 22, 11:19 PM
F15420744: D20327.id48520.diff
Fri, Mar 21, 4:43 PM
F15418716: D20327.id48519.diff
Fri, Mar 21, 1:01 AM
F15416069: D20327.id48520.diff
Thu, Mar 20, 9:02 AM
F15412024: D20327.id.diff
Wed, Mar 19, 10:54 AM
F15409216: D20327.id48518.diff
Wed, Mar 19, 3:38 AM
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.