Path: blob/master/src/infrastructure/markup/blockrule/PhutilRemarkupDefaultBlockRule.php
12241 views
<?php12final class PhutilRemarkupDefaultBlockRule extends PhutilRemarkupBlockRule {34public function getPriority() {5return 750;6}78public function getMatchingLineCount(array $lines, $cursor) {9return 1;10}1112public function markupText($text, $children) {13$engine = $this->getEngine();1415$text = trim($text);16$text = $this->applyRules($text);1718if ($engine->isTextMode()) {19if (!$this->getEngine()->getConfig('preserve-linebreaks')) {20$text = preg_replace('/ *\n */', ' ', $text);21}22return $text;23}2425if ($engine->getConfig('preserve-linebreaks')) {26$text = phutil_escape_html_newlines($text);27}2829if (!strlen($text)) {30return null;31}3233$default_attributes = $engine->getConfig('default.p.attributes');34if ($default_attributes) {35$attributes = $default_attributes;36} else {37$attributes = array();38}3940return phutil_tag('p', $attributes, $text);41}4243}444546