Page MenuHomePhabricator
Paste P1271

Bare img tag support in remarkup, like P1129
ActivePublic

Authored by bougyman on Oct 2 2014, 7:12 PM.
<?php
final class CustomInlineCodeRule extends PhabricatorRemarkupCustomInlineRule {
public function apply($text) {
return preg_replace_callback(
'{<img.*?src="(.*?)".*?>}s',
array($this, 'markupInlineCodeBlock'),
$text);
}
public function getPriority() {
return 200.0;
}
public function markupInlineCodeBlock($matches) {
$engine = $this->getEngine();
$text = $matches[1];
$src = phutil_tag(
'img',
array(
'src' => $text
), '');
return $engine->storeText($src);
}
}
?>

Event Timeline

bougyman edited the content of this paste. (Show Details)Oct 2 2014, 7:12 PM
bougyman changed the title of this paste from untitled to Bare img tag support in remarkup, like P1129 .
bougyman updated the paste's language from autodetect to autodetect.

Relates to P1129 and T4190