Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15417491
D12265.id29459.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D12265.id29459.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,26 @@
// 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
+ // The hashtag must begin with something that is not a ".", a digit, or a
+ // forbidden character.
+ '[^'.$never_first.$never.']+'.
+ '(?:'.
+ // It can have anything except a forbidden character in the middle.
+ '[^'.$never.']*'.
+ // It can have anything except a "." or a forbidden character at the
+ // end.
+ '[^'.$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, Mar 21, 5:18 PM (2 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7715785
Default Alt Text
D12265.id29459.diff (2 KB)
Attached To
Mode
D12265: Tune project hashtags a little more
Attached
Detach File
Event Timeline
Log In to Comment