1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-27 17:22:42 +01:00

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:
epriestley 2015-03-03 10:39:52 -08:00
parent 6b65c578c7
commit f391364bb7
2 changed files with 26 additions and 1 deletions

View file

@ -30,7 +30,7 @@ final class ProjectRemarkupRule extends PhabricatorObjectRemarkupRule {
// In other contexts, the PhabricatorProjectProjectPHIDType pattern is // In other contexts, the PhabricatorProjectProjectPHIDType pattern is
// controlling and these names should parse correctly. // controlling and these names should parse correctly.
return '[^\s.\d!,:;{}#]+(?:[^\s!,:;{}#][^\s.!,:;{}#]+)*'; return '[^\s.\d!,:;{}#\(\)]+(?:[^\s!,:;{}#\(\)][^\s.!,:;{}#\(\)]+)*';
} }
protected function loadObjects(array $ids) { protected function loadObjects(array $ids) {

View file

@ -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) { foreach ($cases as $input => $expect) {