1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-24 22:40: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 $objects = array();
private $viewer; private $viewer;
private $version = 11; private $version = 12;
/* -( Markup Pipeline )---------------------------------------------------- */ /* -( Markup Pipeline )---------------------------------------------------- */

View file

@ -1,8 +1,5 @@
<?php <?php
/**
* @group markup
*/
abstract class PhabricatorRemarkupRuleObject abstract class PhabricatorRemarkupRuleObject
extends PhutilRemarkupRule { extends PhutilRemarkupRule {
@ -119,13 +116,14 @@ abstract class PhabricatorRemarkupRuleObject
$boundary = '\\B'; $boundary = '\\B';
} }
// NOTE: The "(?<!#)" prevents us from linking "#abcdef" or similar. The // NOTE: The "(?<!#)" prevents us from linking "#abcdef" or similar.
// "(?<!/)" prevents us from linking things in URLs. The "\b" allows us to // The "(?<!/)" prevents us from linking things in URIs.
// link "(abcdef)" or similar without linking things in the middle of // The "(?<!;)" prevents linking Diffusion URIs to commits.
// words. // The "\b" allows us to link "(abcdef)" or similar without linking things
// in the middle of words.
$text = preg_replace_callback( $text = preg_replace_callback(
'((?<!#)(?<!/)'.$boundary.$prefix.'('.$id.')(?:#([-\w\d]+))?\b)', '((?<!#)(?<!/)(?<!;)'.$boundary.$prefix.'('.$id.')(?:#([-\w\d]+))?\b)',
array($this, 'markupObjectReference'), array($this, 'markupObjectReference'),
$text); $text);