Page MenuHomePhabricator
Paste P1271

Bare img tag support in remarkup, like P1129
ActivePublic

Authored by bougyman on Oct 2 2014, 7:12 PM.
Tags
None
Referenced Files
F211841: Bare_img_tag_support_in_remarkup,_like_P1129
Oct 2 2014, 7:12 PM
Subscribers
None
<?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 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