mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-30 02:32:42 +01:00
Fix regexp issue with Diffusion remarkup rule
Summary: My `\w` shenanigans don't work with Diffusion, which has no explicit prefix. Test Plan: Typed `rXnnn` and got the whole thing properly marked up. Reviewers: btrahan Reviewed By: btrahan CC: aran Differential Revision: https://secure.phabricator.com/D5984
This commit is contained in:
parent
df50e380ca
commit
cf092781ae
2 changed files with 10 additions and 1 deletions
|
@ -7,6 +7,10 @@ final class DiffusionRemarkupRule
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getObjectNamePrefixBeginsWithWordCharacter() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
protected function getObjectIDPattern() {
|
protected function getObjectIDPattern() {
|
||||||
$min_unqualified = PhabricatorRepository::MINIMUM_UNQUALIFIED_HASH;
|
$min_unqualified = PhabricatorRepository::MINIMUM_UNQUALIFIED_HASH;
|
||||||
$min_qualified = PhabricatorRepository::MINIMUM_QUALIFIED_HASH;
|
$min_qualified = PhabricatorRepository::MINIMUM_QUALIFIED_HASH;
|
||||||
|
|
|
@ -11,6 +11,11 @@ abstract class PhabricatorRemarkupRuleObject
|
||||||
abstract protected function getObjectNamePrefix();
|
abstract protected function getObjectNamePrefix();
|
||||||
abstract protected function loadObjects(array $ids);
|
abstract protected function loadObjects(array $ids);
|
||||||
|
|
||||||
|
protected function getObjectNamePrefixBeginsWithWordCharacter() {
|
||||||
|
$prefix = $this->getObjectNamePrefix();
|
||||||
|
return preg_match('/^\w/', $prefix);
|
||||||
|
}
|
||||||
|
|
||||||
protected function getObjectIDPattern() {
|
protected function getObjectIDPattern() {
|
||||||
return '[1-9]\d*';
|
return '[1-9]\d*';
|
||||||
}
|
}
|
||||||
|
@ -104,7 +109,7 @@ abstract class PhabricatorRemarkupRuleObject
|
||||||
// prefix does not start with a word character, we want to require no word
|
// prefix does not start with a word character, we want to require no word
|
||||||
// boundary for the same reasons. Test if the prefix starts with a word
|
// boundary for the same reasons. Test if the prefix starts with a word
|
||||||
// character.
|
// character.
|
||||||
if (preg_match('/^\w/', $prefix)) {
|
if ($this->getObjectNamePrefixBeginsWithWordCharacter()) {
|
||||||
$boundary = '\\b';
|
$boundary = '\\b';
|
||||||
} else {
|
} else {
|
||||||
$boundary = '\\B';
|
$boundary = '\\B';
|
||||||
|
|
Loading…
Reference in a new issue