mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 12:00:55 +01:00
Don't link objects after a hyphen
Summary: Fixes T5714. Don't link objects when their names appear after a hyphen. Test Plan: Tested `F123` (link), `(F123)` (link), `G12-F123` (no link). Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T5714 Differential Revision: https://secure.phabricator.com/D10456
This commit is contained in:
parent
f02aed10e7
commit
b09f8fa9b8
1 changed files with 4 additions and 2 deletions
|
@ -115,12 +115,14 @@ abstract class PhabricatorObjectRemarkupRule extends PhutilRemarkupRule {
|
|||
$boundary = '\\B';
|
||||
}
|
||||
|
||||
// NOTE: The "(?<!#)" prevents us from linking "#abcdef" or similar.
|
||||
// The "(?<![#-])" prevents us from linking "#abcdef" or similar, and
|
||||
// "ABC-T1" (see T5714).
|
||||
|
||||
// The "\b" allows us to link "(abcdef)" or similar without linking things
|
||||
// in the middle of words.
|
||||
|
||||
$text = preg_replace_callback(
|
||||
'((?<!#)'.$boundary.$prefix.'('.$id.')(?:#([-\w\d]+))?\b)',
|
||||
'((?<![#-])'.$boundary.$prefix.'('.$id.')(?:#([-\w\d]+))?\b)',
|
||||
array($this, 'markupObjectReference'),
|
||||
$text);
|
||||
|
||||
|
|
Loading…
Reference in a new issue