Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14770741
D12265.id29460.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D12265.id29460.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D12265: Tune project hashtags a little more
Attached
Detach File
Event Timeline
Log In to Comment