Changeset View
Changeset View
Standalone View
Standalone View
src/markup/engine/PhutilRemarkupEngine.php
| <?php | <?php | ||||
| final class PhutilRemarkupEngine extends PhutilMarkupEngine { | final class PhutilRemarkupEngine extends PhutilMarkupEngine { | ||||
| const MODE_DEFAULT = 0; | const MODE_DEFAULT = 0; | ||||
| const MODE_TEXT = 1; | const MODE_TEXT = 1; | ||||
| const MODE_HTML_MAIL = 2; | const MODE_HTML_MAIL = 2; | ||||
| const MAX_CHILD_DEPTH = 32; | const MAX_CHILD_DEPTH = 32; | ||||
| private $blockRules = array(); | private $blockRules = array(); | ||||
| private $config = array(); | private $config = array(); | ||||
| private $mode; | private $mode; | ||||
| private $metadata = array(); | private $metadata = array(); | ||||
| private $states = array(); | private $states = array(); | ||||
| private $postprocessRules = array(); | private $postprocessRules = array(); | ||||
| private $storage; | |||||
| public function setConfig($key, $value) { | public function setConfig($key, $value) { | ||||
| $this->config[$key] = $value; | $this->config[$key] = $value; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function getConfig($key, $default = null) { | public function getConfig($key, $default = null) { | ||||
| return idx($this->config, $key, $default); | return idx($this->config, $key, $default); | ||||
| ▲ Show 20 Lines • Show All 99 Lines • ▼ Show 20 Lines | public function preprocessText($text) { | ||||
| $output = array(); | $output = array(); | ||||
| foreach ($blocks as $block) { | foreach ($blocks as $block) { | ||||
| $output[] = $this->markupBlock($block); | $output[] = $this->markupBlock($block); | ||||
| } | } | ||||
| $output = $this->flattenOutput($output); | $output = $this->flattenOutput($output); | ||||
| $map = $this->storage->getMap(); | $map = $this->storage->getMap(); | ||||
| unset($this->storage); | $this->storage = null; | ||||
| $metadata = $this->metadata; | $metadata = $this->metadata; | ||||
| return array( | return array( | ||||
| 'output' => $output, | 'output' => $output, | ||||
| 'storage' => $map, | 'storage' => $map, | ||||
| 'metadata' => $metadata, | 'metadata' => $metadata, | ||||
| ); | ); | ||||
| ▲ Show 20 Lines • Show All 161 Lines • Show Last 20 Lines | |||||