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:
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user