wiki:xref:dokuwiki:inc:parsing:handler:nest.php
- Nest.php
- <?php
- namespace dokuwiki\Parsing\Handler;
- /**
- * Generic call writer class to handle nesting of rendering instructions
- * within a render instruction. Also see nest() method of renderer base class
- *
- * @author Chris Smith <chris@jalakai.co.uk>
- */
- class Nest extends AbstractRewriter
- {
- protected $closingInstruction;
- /**
- * @inheritdoc
- *
- * @param CallWriterInterface $CallWriter the parser's current call writer, i.e. the one above us in the chain
- * @param string $close closing instruction name, this is required to properly terminate the
- * syntax mode if the document ends without a closing pattern
- */
- public function __construct(CallWriterInterface $CallWriter, $close = "nest_close")
- {
- parent::__construct($CallWriter);
- $this->closingInstruction = $close;
- }
- /** @inheritdoc */
- public function writeCall($call)
- {
- $this->calls[] = $call;
- }
- /** @inheritdoc */
- public function writeCalls($calls)
- {
- }
- /** @inheritdoc */
- public function finalise()
- {
- $this->process();
- $this->callWriter->finalise();
- }
- /** @inheritdoc */
- public function process()
- {
- // merge consecutive cdata
- $unmerged_calls = $this->calls;
- foreach ($unmerged_calls as $call) $this->addCall($call);
- return $this->callWriter;
- }
- /**
- * @param array $call
- */
- protected function addCall($call)
- {
- if ($key and ($call[0] == 'cdata') and ($this->calls[$key-1][0] == 'cdata')) {
- $this->calls[$key-1][1][0] .= $call[1][0];
- } elseif ($call[0] == 'eol') {
- // do nothing (eol shouldn't be allowed, to counter preformatted fix in #1652 & #1699)
- } else {
- $this->calls[] = $call;
- }
- }
- }
Только авторизованные участники могут оставлять комментарии.
wiki/xref/dokuwiki/inc/parsing/handler/nest.php.txt · Последнее изменение: — 127.0.0.1