Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F441487
PhabricatorRemarkupBlockInterpreterGraphviz.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
PhabricatorRemarkupBlockInterpreterGraphviz.php
View Options
<?php
final
class
PhabricatorRemarkupBlockInterpreterGraphviz
extends
PhutilRemarkupBlockInterpreter
{
public
function
getInterpreterName
()
{
return
'dot'
;
}
public
function
markupContent
(
$content
,
array
$argv
)
{
if
(!
Filesystem
::
binaryExists
(
'dot'
))
{
return
$this
->
markupError
(
pht
(
'Unable to locate the `dot` binary. Install Graphviz.'
));
}
$future
=
id
(
new
ExecFuture
(
'dot -T%s'
,
'png'
))
->
setTimeout
(
15
)
->
write
(
trim
(
$content
));
list
(
$err
,
$stdout
,
$stderr
)
=
$future
->
resolve
();
if
(
$err
)
{
return
$this
->
markupError
(
pht
(
'Execution of `dot` failed (#%d), check your syntax: %s'
,
$err
,
$stderr
));
}
$file
=
PhabricatorFile
::
buildFromFileDataOrHash
(
$stdout
,
array
(
'name'
=>
'graphviz.png'
,
));
if
(
$this
->
getEngine
()->
isTextMode
())
{
return
'<'
.
$file
->
getBestURI
().
'>'
;
}
return
phutil_tag
(
'img'
,
array
(
'src'
=>
$file
->
getBestURI
(),
));
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, May 4, 7:27 AM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
64474
Default Alt Text
PhabricatorRemarkupBlockInterpreterGraphviz.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment