Don't match parentheses as a hashtag character
Summary: Fixes T6818. Test Plan: Added and ran unit tests. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T6818 Differential Revision: https://secure.phabricator.com/D11954
This commit is contained in:
@@ -30,7 +30,7 @@ final class ProjectRemarkupRule extends PhabricatorObjectRemarkupRule {
|
||||
// In other contexts, the PhabricatorProjectProjectPHIDType pattern is
|
||||
// controlling and these names should parse correctly.
|
||||
|
||||
return '[^\s.\d!,:;{}#]+(?:[^\s!,:;{}#][^\s.!,:;{}#]+)*';
|
||||
return '[^\s.\d!,:;{}#\(\)]+(?:[^\s!,:;{}#\(\)][^\s.!,:;{}#\(\)]+)*';
|
||||
}
|
||||
|
||||
protected function loadObjects(array $ids) {
|
||||
|
||||
@@ -45,6 +45,31 @@ final class ProjectRemarkupRuleTestCase extends PhabricatorTestCase {
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// Don't match a terminal parenthesis. This fixes these constructs in
|
||||
// natural language.
|
||||
'There is some documentation (see #guides).' => array(
|
||||
'embed' => array(),
|
||||
'ref' => array(
|
||||
array(
|
||||
'offset' => 34,
|
||||
'id' => 'guides',
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// Don't match internal parentheses either. This makes the terminal
|
||||
// parenthesis behavior less arbitrary (otherwise, we match open
|
||||
// parentheses but not closing parentheses, which is surprising).
|
||||
'#a(b)c' => array(
|
||||
'embed' => array(),
|
||||
'ref' => array(
|
||||
array(
|
||||
'offset' => 1,
|
||||
'id' => 'a',
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
foreach ($cases as $input => $expect) {
|
||||
|
||||
Reference in New Issue
Block a user