1
0
Fork 0
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:
vrana 2013-02-21 16:13:55 -08:00
parent 8fcf4d5ac3
commit 121ec67d0d
9 changed files with 9 additions and 9 deletions

View file

@ -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>[^}|]+?)'.

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);