xref: /dokuwiki/inc/Parsing/ParserMode/Base.php (revision 47a02a102092be9e1e6f1ddaf158bdfffdb13d4f)
1be906b56SAndreas Gohr<?php
2be906b56SAndreas Gohr
3be906b56SAndreas Gohrnamespace dokuwiki\Parsing\ParserMode;
4be906b56SAndreas Gohr
571096e46SAndreas Gohruse dokuwiki\Parsing\Handler;
6c8dd1b9dSAndreas Gohruse dokuwiki\Parsing\ModeRegistry;
7c8dd1b9dSAndreas Gohr
8be906b56SAndreas Gohrclass Base extends AbstractMode
9be906b56SAndreas Gohr{
10*47a02a10SAndreas Gohr    /** @inheritdoc */
11*47a02a10SAndreas Gohr    protected function allowedCategories(): array
12be906b56SAndreas Gohr    {
13*47a02a10SAndreas Gohr        return [
14c8dd1b9dSAndreas Gohr            ModeRegistry::CATEGORY_CONTAINER,
15c8dd1b9dSAndreas Gohr            ModeRegistry::CATEGORY_BASEONLY,
16c8dd1b9dSAndreas Gohr            ModeRegistry::CATEGORY_PARAGRAPHS,
17c8dd1b9dSAndreas Gohr            ModeRegistry::CATEGORY_FORMATTING,
1856c730b5SAndreas Gohr            ModeRegistry::CATEGORY_SUBSTITUTION,
19c8dd1b9dSAndreas Gohr            ModeRegistry::CATEGORY_PROTECTED,
20c8dd1b9dSAndreas Gohr            ModeRegistry::CATEGORY_DISABLED,
21*47a02a10SAndreas Gohr        ];
22be906b56SAndreas Gohr    }
23be906b56SAndreas Gohr
24be906b56SAndreas Gohr    /** @inheritdoc */
25be906b56SAndreas Gohr    public function getSort()
26be906b56SAndreas Gohr    {
27be906b56SAndreas Gohr        return 0;
28be906b56SAndreas Gohr    }
2971096e46SAndreas Gohr
3071096e46SAndreas Gohr    /** @inheritdoc */
3171096e46SAndreas Gohr    public function handle($match, $state, $pos, Handler $handler)
3271096e46SAndreas Gohr    {
3371096e46SAndreas Gohr        if ($state === DOKU_LEXER_UNMATCHED) {
3471096e46SAndreas Gohr            $handler->addCall('cdata', [$match], $pos);
3571096e46SAndreas Gohr            return true;
3671096e46SAndreas Gohr        }
3771096e46SAndreas Gohr        return false;
3871096e46SAndreas Gohr    }
39be906b56SAndreas Gohr}
40