mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-30 09:20:58 +01:00
Avoid double escaping in Remarkup
Summary: These all work with plain text. Fixes T2574. Test Plan: lang=remarkup > [[ a | <a> ]] - [[ /a | <a> ]] //a**b**c// Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2574 Differential Revision: https://secure.phabricator.com/D5060
This commit is contained in:
parent
8fcf4d5ac3
commit
121ec67d0d
9 changed files with 9 additions and 9 deletions
|
@ -19,7 +19,7 @@ final class DivinerRemarkupRuleSymbol extends PhutilRemarkupRule {
|
|||
// @{name | title}
|
||||
// @{type @ book : name @ context | title}
|
||||
|
||||
return $this->replaceHTML(
|
||||
return preg_replace_callback(
|
||||
'/(?:^|\B)@{'.
|
||||
'(?:(?P<type>[^:]+?):)?'.
|
||||
'(?P<name>[^}|]+?)'.
|
||||
|
|
|
@ -8,7 +8,7 @@ final class PhabricatorRemarkupRuleCountdown extends PhutilRemarkupRule {
|
|||
const KEY_RULE_COUNTDOWN = 'rule.countdown';
|
||||
|
||||
public function apply($text) {
|
||||
return $this->replaceHTML(
|
||||
return preg_replace_callback(
|
||||
"@\B{C(\d+)}\B@",
|
||||
array($this, 'markupCountdown'),
|
||||
$text);
|
||||
|
|
|
@ -10,7 +10,7 @@ final class PhabricatorRemarkupRuleEmbedFile
|
|||
const KEY_EMBED_FILE_PHIDS = 'phabricator.embedded-file-phids';
|
||||
|
||||
public function apply($text) {
|
||||
return $this->replaceHTML(
|
||||
return preg_replace_callback(
|
||||
"@{F(\d+)([^}]+?)?}@",
|
||||
array($this, 'markupEmbedFile'),
|
||||
$text);
|
||||
|
|
|
@ -9,7 +9,7 @@ final class PhabricatorRemarkupRuleImageMacro
|
|||
private $images;
|
||||
|
||||
public function apply($text) {
|
||||
return $this->replaceHTML(
|
||||
return preg_replace_callback(
|
||||
'@^([a-zA-Z0-9:_\-]+)$@m',
|
||||
array($this, 'markupImageMacro'),
|
||||
$text);
|
||||
|
|
|
@ -9,7 +9,7 @@ final class PhabricatorRemarkupRuleMeme
|
|||
private $images;
|
||||
|
||||
public function apply($text) {
|
||||
return $this->replaceHTML(
|
||||
return preg_replace_callback(
|
||||
'@{meme,([^}]+)}$@m',
|
||||
array($this, 'markupMeme'),
|
||||
$text);
|
||||
|
|
|
@ -21,7 +21,7 @@ final class PhabricatorRemarkupRuleMention
|
|||
const REGEX = '/(?<!\w)@([a-zA-Z0-9._-]*[a-zA-Z0-9_-])/';
|
||||
|
||||
public function apply($text) {
|
||||
return $this->replaceHTML(
|
||||
return preg_replace_callback(
|
||||
self::REGEX,
|
||||
array($this, 'markupMention'),
|
||||
$text);
|
||||
|
|
|
@ -13,7 +13,7 @@ abstract class PhabricatorRemarkupRuleObjectHandle
|
|||
|
||||
public function apply($text) {
|
||||
$prefix = $this->getObjectNamePrefix();
|
||||
return $this->replaceHTML(
|
||||
return preg_replace_callback(
|
||||
"@\B{{$prefix}(\d+)}\B@",
|
||||
array($this, 'markupObjectHandle'),
|
||||
$text);
|
||||
|
|
|
@ -15,7 +15,7 @@ abstract class PhabricatorRemarkupRuleObjectName
|
|||
public function apply($text) {
|
||||
$prefix = $this->getObjectNamePrefix();
|
||||
$id = $this->getObjectIDPattern();
|
||||
return $this->replaceHTML(
|
||||
return preg_replace_callback(
|
||||
"@\b({$prefix})({$id})(?:#([-\w\d]+))?\b@",
|
||||
array($this, 'markupObjectNameLink'),
|
||||
$text);
|
||||
|
|
|
@ -7,7 +7,7 @@ final class PhabricatorRemarkupRulePhriction
|
|||
extends PhutilRemarkupRule {
|
||||
|
||||
public function apply($text) {
|
||||
return $this->replaceHTML(
|
||||
return preg_replace_callback(
|
||||
'@\B\\[\\[([^|\\]]+)(?:\\|([^\\]]+))?\\]\\]\B@U',
|
||||
array($this, 'markupDocumentLink'),
|
||||
$text);
|
||||
|
|
Loading…
Reference in a new issue