<?php

use dokuwiki\Extension\SyntaxPlugin;

/**
 * DokuWiki Plugin yatp (Syntax Component)
 *
 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
 * @author Feralheart <dokuwiki@feralheart.dev>
 */
class syntax_plugin_yatp_noinclude extends SyntaxPlugin
{
    /** @inheritDoc */
    public function getType()
    {
        return 'container';
    }

    /** @inheritDoc */
    public function getPType()
    {
        return 'normal';
    }

    /** @inheritDoc */
    public function getSort()
    {
        return 302;
    }

    /** @inheritDoc */
    public function connectTo($mode)
    {
        $this->Lexer->addSpecialPattern('<noinclude>|</noinclude>', $mode, 'plugin_yatp_noinclude');
    }

    /** @inheritDoc */
    public function handle($match, $state, $pos, Doku_Handler $handler)
    {
        return '';
    }

    /** @inheritDoc */
    public function render($mode, Doku_Renderer $renderer, $data)
    {
        if ($mode !== 'xhtml' || !$data) {
            return false;
        }

        return true;
    }
}
