Page MenuHomePhabricator

D8235.id19598.diff
No OneTemporary

D8235.id19598.diff

diff --git a/src/infrastructure/markup/interpreter/PhabricatorRemarkupBlockInterpreterGraphviz.php b/src/infrastructure/markup/interpreter/PhabricatorRemarkupBlockInterpreterGraphviz.php
--- a/src/infrastructure/markup/interpreter/PhabricatorRemarkupBlockInterpreterGraphviz.php
+++ b/src/infrastructure/markup/interpreter/PhabricatorRemarkupBlockInterpreterGraphviz.php
@@ -13,6 +13,14 @@
pht('Unable to locate the `dot` binary. Install Graphviz.'));
}
+ $style = array();
+
+ $width = idx($argv, 'width', '');
+
+ if ($width) {
+ $style[] = 'width: ' . $this->parseDimension($width);
+ }
+
$future = id(new ExecFuture('dot -T%s', 'png'))
->setTimeout(15)
->write(trim($content));
@@ -41,7 +49,19 @@
'img',
array(
'src' => $file->getBestURI(),
+ 'style' => implode(';', $style),
));
}
+ // XXX: This is duplicated from PhabricatorRemarkupRuleEmbedFile
+ // since they do not share a base class
+ private function parseDimension($string) {
+ $string = trim($string);
+
+ if (preg_match('/^(?:\d*\\.)?\d+%?$/', $string)) {
+ return $string;
+ }
+
+ return null;
+ }
}

File Metadata

Mime Type
text/plain
Expires
Sat, Sep 21, 9:22 AM (21 h, 30 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6625287
Default Alt Text
D8235.id19598.diff (1 KB)

Event Timeline