xref: /dokuwiki/inc/Parsing/ParserMode/Strong.php (revision 1c00c02121477c81b95fe750b94acdf109cba20a)
1<?php
2
3namespace dokuwiki\Parsing\ParserMode;
4
5class Strong extends AbstractFormatting
6{
7    /** @inheritdoc */
8    public function getSort()
9    {
10        return 70;
11    }
12
13    /** @inheritdoc */
14    protected function getModeName(): string
15    {
16        return 'strong';
17    }
18
19    /** @inheritdoc */
20    protected function getEntryPattern(): string
21    {
22        // Flanking rules (simplified): opener must be followed by non-whitespace
23        // non-`*`; closer must be preceded by non-whitespace. This rejects
24        // `** foo**`, `**foo **`, and empty pairs `****`.
25        return '\*\*(?=[^\s*])';
26    }
27
28    /** @inheritdoc */
29    protected function getExitPattern(): string
30    {
31        return '(?<=[^\s])\*\*';
32    }
33}
34