3 final class PhabricatorPasteRemarkupRule
extends PhabricatorObjectRemarkupRule
{
5 protected function getObjectNamePrefix() {
9 protected function loadObjects(array $ids) {
10 $viewer = $this->getEngine()->getConfig('viewer');
12 return id(new PhabricatorPasteQuery())
20 protected function renderObjectEmbed(
22 PhabricatorObjectHandle
$handle,
25 $embed_paste = id(new PasteEmbedView())
29 if (strlen($options)) {
30 $parser = new PhutilSimpleOptions();
31 $opts = $parser->parse(substr($options, 1));
33 foreach ($opts as $key => $value) {
34 if ($key == 'lines') {
35 $embed_paste->setLines(preg_replace('/[^0-9]/', '', $value));
36 } else if ($key == 'highlight') {
37 $highlights = preg_split('/,|&/', preg_replace('/\s+/', '', $value));
39 $to_highlight = array();
40 foreach ($highlights as $highlight) {
41 $highlight = explode('-', $highlight);
43 if (!empty($highlight)) {
45 $to_highlight = array_merge(
47 range(head($highlight), last($highlight)));
51 $embed_paste->setHighlights(array_unique($to_highlight));