Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96455123
PhutilRemarkupEngineRemarkupQuotesBlockRule.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, Dec 26, 22:06
Size
932 B
Mime Type
text/x-php
Expires
Sat, Dec 28, 22:06 (1 d, 7 h)
Engine
blob
Format
Raw Data
Handle
23186265
Attached To
rPHU libphutil
PhutilRemarkupEngineRemarkupQuotesBlockRule.php
View Options
<?php
final
class
PhutilRemarkupEngineRemarkupQuotesBlockRule
extends
PhutilRemarkupEngineBlockRule
{
public
function
getMatchingLineCount
(
array
$lines
,
$cursor
)
{
$pos
=
$cursor
;
if
(
preg_match
(
'/^>/'
,
$lines
[
$pos
]))
{
do
{
++
$pos
;
}
while
(
isset
(
$lines
[
$pos
])
&&
preg_match
(
'/^>/'
,
$lines
[
$pos
]));
}
return
(
$pos
-
$cursor
);
}
public
function
supportsChildBlocks
()
{
return
true
;
}
public
function
extractChildText
(
$text
)
{
$text
=
phutil_split_lines
(
$text
,
true
);
foreach
(
$text
as
$key
=>
$line
)
{
$text
[
$key
]
=
substr
(
$line
,
1
);
}
return
array
(
''
,
implode
(
''
,
$text
));
}
public
function
markupText
(
$text
,
$children
)
{
if
(
$this
->
getEngine
()->
isTextMode
())
{
$lines
=
phutil_split_lines
(
$children
);
return
'> '
.
implode
(
"
\n
> "
,
$lines
);
}
return
phutil_tag
(
'blockquote'
,
array
(),
$children
);
}
}
Event Timeline
Log In to Comment