diff options
author | Andreas Gohr <andi@splitbrain.org> | 2018-04-28 12:12:06 +0200 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2018-04-28 12:12:06 +0200 |
commit | 36dc94bb8b05aaaff6fdcf55dd6af80ca30d22b1 (patch) | |
tree | c3f463108ed11ef8e05aab892ceaa16c1b50e6b8 /inc/ParserMode/AbstractMode.php | |
parent | de369923ccbbc3c1e79fd7b4d03677397e03876a (diff) | |
download | dokuwiki-36dc94bb8b05aaaff6fdcf55dd6af80ca30d22b1.tar.gz dokuwiki-36dc94bb8b05aaaff6fdcf55dd6af80ca30d22b1.zip |
split out parser modes into their own files
This moves all the parser classes into their own namespace and files.
Next up are the handler classes.
I'm not sure about the namespace, yet. A nested namepspace Parser\Modes
would probably make more sense... we'll see.
This also removes the duplicated coded in the Plugin mode. We now use
the plugin trait and can inherit from AbstractMode instead.
Diffstat (limited to 'inc/ParserMode/AbstractMode.php')
-rw-r--r-- | inc/ParserMode/AbstractMode.php | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/inc/ParserMode/AbstractMode.php b/inc/ParserMode/AbstractMode.php new file mode 100644 index 000000000..ffd85e67a --- /dev/null +++ b/inc/ParserMode/AbstractMode.php @@ -0,0 +1,40 @@ +<?php + +namespace dokuwiki\ParserMode; + +/** + * This class and all the subclasses below are used to reduce the effort required to register + * modes with the Lexer. + * + * @author Harry Fuecks <hfuecks@gmail.com> + */ +abstract class AbstractMode implements ModeInterface +{ + /** @var \Doku_Lexer $Lexer will be injected on loading */ + public $Lexer; + protected $allowedModes = array(); + + /** @inheritdoc */ + abstract public function getSort(); + + /** @inheritdoc */ + public function preConnect() + { + } + + /** @inheritdoc */ + public function connectTo($mode) + { + } + + /** @inheritdoc */ + public function postConnect() + { + } + + /** @inheritdoc */ + public function accepts($mode) + { + return in_array($mode, (array) $this->allowedModes); + } +} |