Page MenuHomePhabricator

D12265.id29460.diff
No OneTemporary

D12265.id29460.diff

diff --git a/src/applications/project/remarkup/ProjectRemarkupRule.php b/src/applications/project/remarkup/ProjectRemarkupRule.php
--- a/src/applications/project/remarkup/ProjectRemarkupRule.php
+++ b/src/applications/project/remarkup/ProjectRemarkupRule.php
@@ -30,7 +30,21 @@
// In other contexts, the PhabricatorProjectProjectPHIDType pattern is
// controlling and these names should parse correctly.
- return '[^\s.\d!,:;{}#\(\)]+(?:[^\s!,:;{}#\(\)]*[^\s.!,:;{}#\(\)]+)*';
+ // These characters may never appear anywhere in a hashtag.
+ $never = '\s?!,:;{}#\\(\\)"\'';
+
+ // These characters may not appear at the beginning.
+ $never_first = '.\d';
+
+ // These characters may not appear at the end.
+ $never_last = '.';
+
+ return
+ '[^'.$never_first.$never.']+'.
+ '(?:'.
+ '[^'.$never.']*'.
+ '[^'.$never_last.$never.']+'.
+ ')*';
}
protected function loadObjects(array $ids) {
diff --git a/src/applications/project/remarkup/__tests__/ProjectRemarkupRuleTestCase.php b/src/applications/project/remarkup/__tests__/ProjectRemarkupRuleTestCase.php
--- a/src/applications/project/remarkup/__tests__/ProjectRemarkupRuleTestCase.php
+++ b/src/applications/project/remarkup/__tests__/ProjectRemarkupRuleTestCase.php
@@ -81,6 +81,36 @@
),
),
+ 'Is this #urgent?' => array(
+ 'embed' => array(),
+ 'ref' => array(
+ array(
+ 'offset' => 9,
+ 'id' => 'urgent',
+ ),
+ ),
+ ),
+
+ 'This is "#urgent".' => array(
+ 'embed' => array(),
+ 'ref' => array(
+ array(
+ 'offset' => 10,
+ 'id' => 'urgent',
+ ),
+ ),
+ ),
+
+ 'This is \'#urgent\'.' => array(
+ 'embed' => array(),
+ 'ref' => array(
+ array(
+ 'offset' => 10,
+ 'id' => 'urgent',
+ ),
+ ),
+ ),
+
);
foreach ($cases as $input => $expect) {

File Metadata

Mime Type
text/plain
Expires
Fri, Jan 24, 9:30 PM (21 h, 4 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7042423
Default Alt Text
D12265.id29460.diff (1 KB)

Event Timeline