import
[web.mtrack] / inc / hyperlight / wiki.php
1 <?php # vim:ts=2:sw=2:et:
2 /* For licensing and copyright terms, see the file named LICENSE */
3
4 class WikiLanguage extends HyperLanguage {
5   public function __construct() {
6     $this->setInfo(array(
7           parent::NAME => 'Wiki',
8           ));
9     $this->setExtensions(array('wiki'));
10     $this->setCaseInsensitive(false);
11     $this->addStates(array(
12           'init' => array(
13             'bold',
14             'macro',
15             'link',
16             'replink',
17             'keyword' => array('operator'),
18             ),
19           ));
20
21     $this->addRules(array(
22           'bold' => "/'''(?:\\\\'|.)*?'''/s",
23           'macro' => "/\[\[.*\]\]/s",
24           'link' => "/\[[a-z]+:.*\]/Us",
25           'replink' => "/\{[^}]+\}/Us",
26           'keyword' => array(
27             'operator' => '/=+/',
28             ),
29           ));
30         $this->addMappings(array(
31             'bold' => 'string',
32             'link' => 'tag',
33             'replink' => 'tag',
34             'macro' => 'tag',
35         ));
36
37   }
38 }