Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13982087
D14547.id35184.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
D14547.id35184.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
@@ -20,17 +20,13 @@
}
protected function getObjectIDPattern() {
- // NOTE: This explicitly does not match strings which contain only
- // digits, because digit strings like "#123" are used to reference tasks at
- // Facebook and are somewhat conventional in general.
-
- // The latter half of this rule matches monograms with internal periods,
- // like `#domain.com`, but does not match monograms with terminal periods,
- // because they're probably just puncutation.
+ // NOTE: The latter half of this rule matches monograms with internal
+ // periods, like `#domain.com`, but does not match monograms with terminal
+ // periods, because they're probably just puncutation.
// Broadly, this will not match every possible project monogram, and we
- // accept some false negatives -- like `#1` or `#dot.` -- in order to avoid
- // a bunch of false positives on general use of the `#` character.
+ // accept some false negatives -- like `#dot.` -- in order to avoid a bunch
+ // of false positives on general use of the `#` character.
// In other contexts, the PhabricatorProjectProjectPHIDType pattern is
// controlling and these names should parse correctly.
@@ -38,14 +34,11 @@
// 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_last.$never.']+'.
'(?:'.
'[^'.$never.']*'.
'[^'.$never_last.$never.']+'.
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
@@ -33,7 +33,21 @@
),
'#123' => array(
'embed' => array(),
- 'ref' => array(),
+ 'ref' => array(
+ array(
+ 'offset' => 1,
+ 'id' => '123',
+ ),
+ ),
+ ),
+ '#2x4' => array(
+ 'embed' => array(),
+ 'ref' => array(
+ array(
+ 'offset' => 1,
+ 'id' => '2x4',
+ ),
+ ),
),
'#security#123' => array(
'embed' => array(),
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Oct 20, 9:10 PM (4 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6723106
Default Alt Text
D14547.id35184.diff (2 KB)
Attached To
Mode
D14547: Markup project hashtags which begin with (or contain only) digits
Attached
Detach File
Event Timeline
Log In to Comment