From 89b9d56cbe641a002cec0e32f6667ebceb482830 Mon Sep 17 00:00:00 2001 From: vrana Date: Mon, 22 Oct 2012 11:05:44 -0700 Subject: [PATCH] Unlink Q1 - Q4 Summary: Q1 to Q4 is used for parts of the year. Also unlink all `[A-Z]0.*`, we don't route them anymore. Test Plan: Q0 Q1 Q10 Reviewers: epriestley, pieter Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D3781 --- .../markup/rule/PhabricatorRemarkupRuleObjectName.php | 11 +++++------ src/infrastructure/markup/rule/PonderRuleQuestion.php | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/infrastructure/markup/rule/PhabricatorRemarkupRuleObjectName.php b/src/infrastructure/markup/rule/PhabricatorRemarkupRuleObjectName.php index a992209e57..c354c80e5d 100644 --- a/src/infrastructure/markup/rule/PhabricatorRemarkupRuleObjectName.php +++ b/src/infrastructure/markup/rule/PhabricatorRemarkupRuleObjectName.php @@ -27,18 +27,17 @@ abstract class PhabricatorRemarkupRuleObjectName public function apply($text) { $prefix = $this->getObjectNamePrefix(); return preg_replace_callback( - "@\b{$prefix}(\d+)(?:#([-\w\d]+))?\b@", + "@\b({$prefix})([1-9]\d*)(?:#([-\w\d]+))?\b@", array($this, 'markupObjectNameLink'), $text); } public function markupObjectNameLink($matches) { - $prefix = $this->getObjectNamePrefix(); - $id = $matches[1]; + list(, $prefix, $id) = $matches; - if (isset($matches[2])) { - $href = $matches[2]; - $text = $matches[2]; + if (isset($matches[3])) { + $href = $matches[3]; + $text = $matches[3]; if (preg_match('@^(?:comment-)?(\d{1,7})$@', $href, $matches)) { // Maximum length is 7 because 12345678 could be a file hash. $href = "comment-{$matches[1]}"; diff --git a/src/infrastructure/markup/rule/PonderRuleQuestion.php b/src/infrastructure/markup/rule/PonderRuleQuestion.php index 8f017e4386..8841c30207 100644 --- a/src/infrastructure/markup/rule/PonderRuleQuestion.php +++ b/src/infrastructure/markup/rule/PonderRuleQuestion.php @@ -23,7 +23,7 @@ final class PonderRuleQuestion extends PhabricatorRemarkupRuleObjectName { protected function getObjectNamePrefix() { - return 'Q'; + return 'Q(?![1-4]\b)'; } }