Implement text mode for Phabricator Remarkup rules

Test Plan:
  lang=remarkup
  D1
  {D1}
  {C1}
  {F1}
  [[ Test ]]
  iiam
  {meme, src=iiam, above="I\'m not always", below="But I am"}
  @{function:pht}
  @vrana

Reviewers: epriestley, edward

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T2617

Differential Revision: https://secure.phabricator.com/D5392
This commit is contained in:
Jakub Vrana
2013-03-22 17:33:36 -07:00
parent c81592bf5c
commit efe0c135fe
9 changed files with 73 additions and 15 deletions

View File

@@ -35,6 +35,14 @@ final class PhabricatorRemarkupRuleImageMacro
$phid = $this->images[$name];
$file = id(new PhabricatorFile())->loadOneWhere('phid = %s', $phid);
if ($this->getEngine()->isTextMode()) {
if ($file) {
$name .= ' <'.$file->getBestURI().'>';
}
return $this->getEngine()->storeText($name);
}
$style = null;
$src_uri = null;
if ($file) {

View File

@@ -30,11 +30,18 @@ final class PhabricatorRemarkupRuleMeme
->alter('uppertext', $options['above'])
->alter('lowertext', $options['below']);
$img = phutil_tag(
'img',
array(
'src' => (string)$uri,
));
if ($this->getEngine()->isTextMode()) {
$img =
($options['above'] != '' ? "\"{$options['above']}\"\n" : '').
$options['src'].' <'.PhabricatorEnv::getProductionURI($uri).'>'.
($options['below'] != '' ? "\n\"{$options['below']}\"" : '');
} else {
$img = phutil_tag(
'img',
array(
'src' => (string)$uri,
));
}
return $this->getEngine()->storeText($img);
}