Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F92640378
PhutilDefaultSyntaxHighlighterEnginePygmentsFuture.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Nov 22, 07:37
Size
813 B
Mime Type
text/x-php
Expires
Sun, Nov 24, 07:37 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22474301
Attached To
rPHU libphutil
PhutilDefaultSyntaxHighlighterEnginePygmentsFuture.php
View Options
<?php
/**
* @group markup
*/
final
class
PhutilDefaultSyntaxHighlighterEnginePygmentsFuture
extends
FutureProxy
{
private
$source
;
private
$scrub
;
public
function
__construct
(
Future
$proxied
,
$source
,
$scrub
=
false
)
{
parent
::
__construct
(
$proxied
);
$this
->
source
=
$source
;
$this
->
scrub
=
$scrub
;
}
protected
function
didReceiveResult
(
$result
)
{
list
(
$err
,
$stdout
,
$stderr
)
=
$result
;
if
(!
$err
&&
strlen
(
$stdout
))
{
// Strip off fluff Pygments adds.
$stdout
=
preg_replace
(
'@^<div class="highlight"><pre>(.*)</pre></div>
\s
*$@s'
,
'
\1
'
,
$stdout
);
if
(
$this
->
scrub
)
{
$stdout
=
preg_replace
(
'/^.*
\n
/'
,
''
,
$stdout
);
}
return
$stdout
;
}
throw
new
PhutilSyntaxHighlighterException
(
$stderr
,
$err
);
}
}
Event Timeline
Log In to Comment