Page MenuHomePhabricator

Add Phurl Remarkup
ClosedPublic

Authored by lpriestley on Nov 6 2015, 9:51 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Dec 15, 4:37 PM
Unknown Object (File)
Tue, Dec 10, 10:41 AM
Unknown Object (File)
Fri, Dec 6, 2:23 PM
Unknown Object (File)
Sat, Nov 30, 4:01 PM
Unknown Object (File)
Wed, Nov 27, 3:41 PM
Unknown Object (File)
Sun, Nov 24, 12:56 AM
Unknown Object (File)
Nov 19 2024, 12:33 PM
Unknown Object (File)
Nov 15 2024, 7:07 AM
Subscribers

Details

Reviewers
epriestley
Group Reviewers
Blessed Reviewers
Maniphest Tasks
T9722: Add Phurl Remarkup
Commits
Restricted Diffusion Commit
rP268fac25d544: Add Phurl Remarkup
Summary

Ref T9722, Add Phurl Remarkup as ((id)) or ((alias))

Test Plan

Add a comment to any object as ((id)) or ((alias)). Make sure comment renders as a link.

Diff Detail

Repository
rP Phabricator
Branch
phurlremarkup
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 8668
Build 10048: Run Core Tests
Build 10047: arc lint + arc unit

Event Timeline

lpriestley retitled this revision from to Add Phurl Remarkup.
lpriestley updated this object.
lpriestley edited the test plan for this revision. (Show Details)
lpriestley added a reviewer: epriestley.
epriestley edited edge metadata.

This looks good, but see a few inlines for additional behaviors.

src/applications/phurl/remarkup/PhabricatorPhurlLinkRemarkupRule.php
14

I think the character class in the middle should include space at a minium ([^ )]) so that ((blah blah blah)) (with actual spaces) doesn't trigger. Possibly we should get a little stricter about it so that ((^_^)) doesn't trigger, although I don't know how many false positives we're really going to see.

But it would be bad if stuff like if ((a == b) || (c == d)) {... triggered it -- that one won't since it has a ) inside it, but

This isn't really a big deal since ((...)) is uncommon even in programming, but I think we should be slightly stricter than this.

19

We should include these checks:

An if (!$this->isFlatText($matches[0])) test, like IconRemarkupRule has. This prevents us from doing bad stuff with input like this:

(([[a|b]]))

That should render as ((b)), with b as a link to a, not as a Phurl.

A text mode check. Maybe return text like this?

See "URL Name" <https://install.com/u/example>

An HTML mail mode check, which can probably just render a normal link.

38

I'd tend to expect this to be a TagView (like Txxx), not an IconView (like {icon ...}).

44

This should just return the original text -- if I type ((zebra)) or ((289379827)) and there's no such link (or the viewer can't see it) we should just return the text as-is.

This revision now requires changes to proceed.Nov 6 2015, 10:03 PM
src/applications/phurl/remarkup/PhabricatorPhurlLinkRemarkupRule.php
38

Is there a way to make the TagView look like an actual link?

lpriestley edited edge metadata.

Adding $text_mode and $mail_mode

You can just use phutil_tag('a', ...) if you want a plain link. I don't have a strong opinion on a plain link vs an object reference style tag thing.

lpriestley edited edge metadata.

Removing PHUITagView in favor of a simple phutil_tag link

epriestley edited edge metadata.
epriestley added inline comments.
src/applications/phurl/remarkup/PhabricatorPhurlLinkRemarkupRule.php
23

$mail_mode is never actually used to render a mail version, although that's fine now that we're just rendering a normal link. But you could get rid of the call here since the mail and HTML modes are the same now.

This revision is now accepted and ready to land.Nov 7 2015, 3:05 AM
lpriestley edited edge metadata.

Leaving out $mail_mode

This revision was automatically updated to reflect the committed changes.