Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F101243017
PhutilRemarkupEngineRemarkupHorizontalRuleBlockRule.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, Feb 7, 03:17
Size
839 B
Mime Type
text/x-php
Expires
Sun, Feb 9, 03:17 (2 d)
Engine
blob
Format
Raw Data
Handle
24122070
Attached To
rPHU libphutil
PhutilRemarkupEngineRemarkupHorizontalRuleBlockRule.php
View Options
<?php
/**
* @group markup
*/
final
class
PhutilRemarkupEngineRemarkupHorizontalRuleBlockRule
extends
PhutilRemarkupEngineBlockRule
{
/**
* This rule executes at priority `300`, so it can preempt the list block
* rule and claim blocks which begin `---`.
*/
public
function
getPriority
()
{
return
300
;
}
public
function
getMatchingLineCount
(
array
$lines
,
$cursor
)
{
$num_lines
=
0
;
$pattern
=
'/^_{3,}$|^
\*\s
?
\*\s
?
\*
(
\s
|
\*
)*$|^
\-\s
?
\-\s
?
\-
(
\s
|
\-
)*$/'
;
if
(
preg_match
(
$pattern
,
rtrim
(
$lines
[
$cursor
],
"
\n\r
"
)))
{
$num_lines
++;
$cursor
++;
while
(
isset
(
$lines
[
$cursor
])
&&
!
strlen
(
trim
(
$lines
[
$cursor
])))
{
$num_lines
++;
$cursor
++;
}
}
return
$num_lines
;
}
public
function
markupText
(
$text
,
$children
)
{
return
phutil_tag
(
'hr'
,
array
());
}
}
Event Timeline
Log In to Comment