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