xref: /dokuwiki/inc/Parsing/ParserMode/Quote.php (revision c8dd1b9d24a2f9905db764a0ac4646fb1e172af4)
1be906b56SAndreas Gohr<?php
2be906b56SAndreas Gohr
3be906b56SAndreas Gohrnamespace dokuwiki\Parsing\ParserMode;
4be906b56SAndreas Gohr
5*c8dd1b9dSAndreas Gohruse dokuwiki\Parsing\ModeRegistry;
6*c8dd1b9dSAndreas Gohr
7be906b56SAndreas Gohrclass Quote extends AbstractMode
8be906b56SAndreas Gohr{
9be906b56SAndreas Gohr    /**
10be906b56SAndreas Gohr     * Quote constructor.
11be906b56SAndreas Gohr     */
12be906b56SAndreas Gohr    public function __construct()
13be906b56SAndreas Gohr    {
14*c8dd1b9dSAndreas Gohr        $this->allowedModes = ModeRegistry::getInstance()->getModesForCategories([
15*c8dd1b9dSAndreas Gohr            ModeRegistry::CATEGORY_FORMATTING,
16*c8dd1b9dSAndreas Gohr            ModeRegistry::CATEGORY_SUBSTITION,
17*c8dd1b9dSAndreas Gohr            ModeRegistry::CATEGORY_DISABLED,
18*c8dd1b9dSAndreas Gohr            ModeRegistry::CATEGORY_PROTECTED,
19*c8dd1b9dSAndreas Gohr        ]);
20be906b56SAndreas Gohr    }
21be906b56SAndreas Gohr
22be906b56SAndreas Gohr    /** @inheritdoc */
23be906b56SAndreas Gohr    public function connectTo($mode)
24be906b56SAndreas Gohr    {
25be906b56SAndreas Gohr        $this->Lexer->addEntryPattern('\n>{1,}', $mode, 'quote');
26be906b56SAndreas Gohr    }
27be906b56SAndreas Gohr
28be906b56SAndreas Gohr    /** @inheritdoc */
29be906b56SAndreas Gohr    public function postConnect()
30be906b56SAndreas Gohr    {
31be906b56SAndreas Gohr        $this->Lexer->addPattern('\n>{1,}', 'quote');
32be906b56SAndreas Gohr        $this->Lexer->addExitPattern('\n', 'quote');
33be906b56SAndreas Gohr    }
34be906b56SAndreas Gohr
35be906b56SAndreas Gohr    /** @inheritdoc */
36be906b56SAndreas Gohr    public function getSort()
37be906b56SAndreas Gohr    {
38be906b56SAndreas Gohr        return 220;
39be906b56SAndreas Gohr    }
40be906b56SAndreas Gohr}
41