Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2896438
PhutilRemarkupHorizontalRuleBlockRule.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
898 B
Referenced Files
None
Subscribers
None
PhutilRemarkupHorizontalRuleBlockRule.php
View Options
<?php
final
class
PhutilRemarkupHorizontalRuleBlockRule
extends
PhutilRemarkupBlockRule
{
/**
* 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
=
'/^\s*(?:_{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
)
{
if
(
$this
->
getEngine
(
)
->
isTextMode
(
)
)
{
return
rtrim
(
$text
)
;
}
return
phutil_tag
(
'hr'
,
array
(
'class'
=>
'remarkup-hr'
)
)
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Jan 19 2025, 23:06 (6 w, 3 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1129696
Default Alt Text
PhutilRemarkupHorizontalRuleBlockRule.php (898 B)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment