Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/infrastructure/markup/blockrule/PhutilRemarkupQuotesBlockRule.php
12241 views
1
<?php
2
3
final class PhutilRemarkupQuotesBlockRule
4
extends PhutilRemarkupQuotedBlockRule {
5
6
public function getMatchingLineCount(array $lines, $cursor) {
7
$pos = $cursor;
8
9
if (preg_match('/^>/', $lines[$pos])) {
10
do {
11
++$pos;
12
} while (isset($lines[$pos]) && preg_match('/^>/', $lines[$pos]));
13
}
14
15
return ($pos - $cursor);
16
}
17
18
public function extractChildText($text) {
19
return array('', $this->normalizeQuotedBody($text));
20
}
21
22
public function markupText($text, $children) {
23
if ($this->getEngine()->isTextMode()) {
24
return $this->getQuotedText($children);
25
}
26
27
$attributes = array();
28
if ($this->getEngine()->isHTMLMailMode()) {
29
$style = array(
30
'border-left: 3px solid #a7b5bf;',
31
'color: #464c5c;',
32
'font-style: italic;',
33
'margin: 4px 0 12px 0;',
34
'padding: 4px 12px;',
35
'background-color: #f8f9fc;',
36
);
37
38
$attributes['style'] = implode(' ', $style);
39
}
40
41
return phutil_tag(
42
'blockquote',
43
$attributes,
44
$children);
45
}
46
47
}
48
49