@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Use remarkup rule priorities in Phabricator

Summary:
Depends on D6329. This fixes `http://www.example.com/D123`, which currently gets the "D123" rendered, after addition of the Asana rule. It also removes a hack for object refernces.

Basically, the "hyperlink" rule needs to happen after rules which specialize hyperlinks (Youtube, Asana) but before rules which apply to general text (like the Differential and Maniphest rules). Allow these rules to specify that they have higher or lower priority.

Test Plan: Asana rules, Differential rules and Diffusion rules now all markup correctly.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

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

+9 -5
+1 -5
src/applications/diffusion/remarkup/DiffusionRemarkupRule.php
··· 15 15 $min_unqualified = PhabricatorRepository::MINIMUM_UNQUALIFIED_HASH; 16 16 $min_qualified = PhabricatorRepository::MINIMUM_QUALIFIED_HASH; 17 17 18 - // NOTE: The "(?<!/)" negative lookbehind prevents this rule from matching 19 - // hashes or hash-like substrings in most URLs. For example, this will not 20 - // match: http://www.example.com/article/28903218328/ 21 - 22 18 return 23 19 'r[A-Z]+[1-9]\d*'. 24 20 '|'. 25 21 'r[A-Z]+[a-f0-9]{'.$min_qualified.',40}'. 26 22 '|'. 27 - '(?<!/)[a-f0-9]{'.$min_unqualified.',40}'; 23 + '[a-f0-9]{'.$min_unqualified.',40}'; 28 24 } 29 25 30 26 protected function loadObjects(array $ids) {
+4
src/applications/doorkeeper/remarkup/DoorkeeperRemarkupRuleAsana.php
··· 5 5 6 6 const KEY_TAGS = 'doorkeeper.tags'; 7 7 8 + public function getPriority() { 9 + return 350.0; 10 + } 11 + 8 12 public function apply($text) { 9 13 return preg_replace_callback( 10 14 '@https://app\\.asana\\.com/0/(\\d+)/(\\d+)@',
+4
src/infrastructure/markup/rule/PhabricatorRemarkupRuleYoutube.php
··· 6 6 final class PhabricatorRemarkupRuleYoutube 7 7 extends PhutilRemarkupRule { 8 8 9 + public function getPriority() { 10 + return 350.0; 11 + } 12 + 9 13 public function apply($text) { 10 14 $this->uri = new PhutilURI($text); 11 15