Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13958091
D10915.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D10915.id.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -454,6 +454,7 @@
'DiffusionCommitQuery' => 'applications/diffusion/query/DiffusionCommitQuery.php',
'DiffusionCommitRef' => 'applications/diffusion/data/DiffusionCommitRef.php',
'DiffusionCommitRemarkupRule' => 'applications/diffusion/remarkup/DiffusionCommitRemarkupRule.php',
+ 'DiffusionCommitRemarkupRuleTestCase' => 'applications/diffusion/remarkup/__tests__/DiffusionCommitRemarkupRuleTestCase.php',
'DiffusionCommitTagsController' => 'applications/diffusion/controller/DiffusionCommitTagsController.php',
'DiffusionConduitAPIMethod' => 'applications/diffusion/conduit/DiffusionConduitAPIMethod.php',
'DiffusionController' => 'applications/diffusion/controller/DiffusionController.php',
@@ -3458,6 +3459,7 @@
'DiffusionCommitQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'DiffusionCommitRef' => 'Phobject',
'DiffusionCommitRemarkupRule' => 'PhabricatorObjectRemarkupRule',
+ 'DiffusionCommitRemarkupRuleTestCase' => 'PhabricatorTestCase',
'DiffusionCommitTagsController' => 'DiffusionController',
'DiffusionConduitAPIMethod' => 'ConduitAPIMethod',
'DiffusionController' => 'PhabricatorController',
diff --git a/src/applications/diffusion/remarkup/__tests__/DiffusionCommitRemarkupRuleTestCase.php b/src/applications/diffusion/remarkup/__tests__/DiffusionCommitRemarkupRuleTestCase.php
new file mode 100644
--- /dev/null
+++ b/src/applications/diffusion/remarkup/__tests__/DiffusionCommitRemarkupRuleTestCase.php
@@ -0,0 +1,60 @@
+<?php
+
+final class DiffusionCommitRemarkupRuleTestCase extends PhabricatorTestCase {
+
+ public function testProjectObjectRemarkup() {
+ $cases = array(
+ '{rP12f3f6d3a9ef9c7731051815846810cb3c4cd248}' => array(
+ 'embed' => array(
+ array(
+ 'offset' => 1,
+ 'id' => 'rP12f3f6d3a9ef9c7731051815846810cb3c4cd248',
+ ),
+ ),
+ 'ref' => array(
+ array(
+ 'offset' => 1,
+ 'id' => 'rP12f3f6d3a9ef9c7731051815846810cb3c4cd248',
+ ),
+ ),
+ ),
+ '{rP1234, key=value}' => array(
+ 'embed' => array(
+ array(
+ 'offset' => 1,
+ 'id' => 'rP1234',
+ 'tail' => ', key=value',
+ ),
+ ),
+ 'ref' => array(
+ array(
+ 'offset' => 1,
+ 'id' => 'rP1234',
+ ),
+ ),
+ ),
+ '{rP1234 key=value}' => array(
+ 'embed' => array(
+ array(
+ 'offset' => 1,
+ 'id' => 'rP1234',
+ 'tail' => ' key=value',
+ ),
+ ),
+ 'ref' => array(
+ array(
+ 'offset' => 1,
+ 'id' => 'rP1234',
+ ),
+ ),
+ ),
+ );
+
+ foreach ($cases as $input => $expect) {
+ $rule = new DiffusionCommitRemarkupRule();
+ $matches = $rule->extractReferences($input);
+ $this->assertEqual($expect, $matches, $input);
+ }
+ }
+
+}
diff --git a/src/infrastructure/markup/rule/PhabricatorObjectRemarkupRule.php b/src/infrastructure/markup/rule/PhabricatorObjectRemarkupRule.php
--- a/src/infrastructure/markup/rule/PhabricatorObjectRemarkupRule.php
+++ b/src/infrastructure/markup/rule/PhabricatorObjectRemarkupRule.php
@@ -166,7 +166,7 @@
$prefix = preg_quote($prefix);
$id = $this->getObjectIDPattern();
- return '(\B{'.$prefix.'('.$id.')((?:[^}\\\\]|\\\\.)*)}\B)u';
+ return '(\B{'.$prefix.'('.$id.')([,\s](?:[^}\\\\]|\\\\.)*)?}\B)u';
}
private function getObjectReferencePattern() {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Oct 15 2024, 12:49 PM (4 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6712894
Default Alt Text
D10915.id.diff (3 KB)
Attached To
Mode
D10915: Fix an issue with tail parsing in object embeds in remarkup
Attached
Detach File
Event Timeline
Log In to Comment