Path: blob/master/src/infrastructure/markup/blockrule/PhutilRemarkupReplyBlockRule.php
12241 views
<?php12final class PhutilRemarkupReplyBlockRule3extends PhutilRemarkupQuotedBlockRule {45public function getPriority() {6return 400;7}89public function getMatchingLineCount(array $lines, $cursor) {10$pos = $cursor;1112if (preg_match('/^>>!/', $lines[$pos])) {13do {14++$pos;15} while (isset($lines[$pos]) && preg_match('/^>/', $lines[$pos]));16}1718return ($pos - $cursor);19}2021public function extractChildText($text) {22$text = phutil_split_lines($text, true);2324$head = substr(reset($text), 3);2526$body = array_slice($text, 1);27$body = implode('', $body);28$body = $this->normalizeQuotedBody($body);2930return array(trim($head), $body);31}3233public function markupText($text, $children) {34$text = $this->applyRules($text);3536if ($this->getEngine()->isTextMode()) {37$children = $this->getQuotedText($children);38return $text."\n\n".$children;39}4041if ($this->getEngine()->isHTMLMailMode()) {42$block_attributes = array(43'style' => 'border-left: 3px solid #8C98B8;44color: #6B748C;45font-style: italic;46margin: 4px 0 12px 0;47padding: 8px 12px;48background-color: #F8F9FC;',49);50$head_attributes = array(51'style' => 'font-style: normal;52padding-bottom: 4px;',53);54$reply_attributes = array(55'style' => 'margin: 0;56padding: 0;57border: 0;58color: rgb(107, 116, 140);',59);60} else {61$block_attributes = array(62'class' => 'remarkup-reply-block',63);64$head_attributes = array(65'class' => 'remarkup-reply-head',66);67$reply_attributes = array(68'class' => 'remarkup-reply-body',69);70}7172return phutil_tag(73'blockquote',74$block_attributes,75array(76"\n",77phutil_tag(78'div',79$head_attributes,80$text),81"\n",82phutil_tag(83'div',84$reply_attributes,85$children),86"\n",87));88}8990}919293