1<?php
2
3namespace dokuwiki\Parsing\ParserMode;
4
5class Quotes extends AbstractMode
6{
7    /** @inheritdoc */
8    public function connectTo($mode)
9    {
10        global $conf;
11
12        $ws   =  '\s/\#~:+=&%@\-\x28\x29\]\[{}><"\'';   // whitespace
13        $punc =  ';,\.?!';
14
15        if ($conf['typography'] == 2) {
16            $this->Lexer->addSpecialPattern(
17                "(?<=^|[$ws])'(?=[^$ws$punc])",
18                $mode,
19                'singlequoteopening'
20            );
21            $this->Lexer->addSpecialPattern(
22                "(?<=^|[^$ws]|[$punc])'(?=$|[$ws$punc])",
23                $mode,
24                'singlequoteclosing'
25            );
26            $this->Lexer->addSpecialPattern(
27                "(?<=^|[^$ws$punc])'(?=$|[^$ws$punc])",
28                $mode,
29                'apostrophe'
30            );
31        }
32
33        $this->Lexer->addSpecialPattern(
34            "(?<=^|[$ws])\"(?=[^$ws$punc])",
35            $mode,
36            'doublequoteopening'
37        );
38        $this->Lexer->addSpecialPattern(
39            "\"",
40            $mode,
41            'doublequoteclosing'
42        );
43    }
44
45    /** @inheritdoc */
46    public function getSort()
47    {
48        return 280;
49    }
50}
51