Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93437723
PhutilRemarkupRuleMonospace.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
Thu, Nov 28, 18:27
Size
502 B
Mime Type
text/x-php
Expires
Sat, Nov 30, 18:27 (2 d)
Engine
blob
Format
Raw Data
Handle
22637629
Attached To
rPHU libphutil
PhutilRemarkupRuleMonospace.php
View Options
<?php
/**
* @group markup
*/
final
class
PhutilRemarkupRuleMonospace
extends
PhutilRemarkupRule
{
public
function
apply
(
$text
)
{
return
preg_replace_callback
(
'@##([
\s\S
]+?)##|
\B
`(.+?)`
\B
@'
,
array
(
$this
,
'markupMonospacedText'
),
$text
);
}
private
function
markupMonospacedText
(
$matches
)
{
$match
=
isset
(
$matches
[
2
])
?
$matches
[
2
]
:
$matches
[
1
];
$result
=
'<tt>'
.
phutil_escape_html
(
$match
).
'</tt>'
;
return
$this
->
getEngine
()->
storeText
(
$result
);
}
}
Event Timeline
Log In to Comment