1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-19 20:10:55 +01:00

Minor, don't link commits after a semicolon

Summary: This stops us from trying to capture commit refs in Diffusion URIs.

Auditors: btrahan
This commit is contained in:
epriestley 2014-07-05 09:47:25 -07:00
parent 8fa1708940
commit 8a39ee067b
2 changed files with 7 additions and 9 deletions

View file

@ -41,7 +41,7 @@ final class PhabricatorMarkupEngine {
private $objects = array();
private $viewer;
private $version = 11;
private $version = 12;
/* -( Markup Pipeline )---------------------------------------------------- */

View file

@ -1,8 +1,5 @@
<?php
/**
* @group markup
*/
abstract class PhabricatorRemarkupRuleObject
extends PhutilRemarkupRule {
@ -119,13 +116,14 @@ abstract class PhabricatorRemarkupRuleObject
$boundary = '\\B';
}
// NOTE: The "(?<!#)" prevents us from linking "#abcdef" or similar. The
// "(?<!/)" prevents us from linking things in URLs. The "\b" allows us to
// link "(abcdef)" or similar without linking things in the middle of
// words.
// NOTE: The "(?<!#)" prevents us from linking "#abcdef" or similar.
// The "(?<!/)" prevents us from linking things in URIs.
// The "(?<!;)" prevents linking Diffusion URIs to commits.
// 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);