ajout de la partie slam dans le dossier web
This commit is contained in:
		
							
								
								
									
										40
									
								
								ap23/web/doku/inc/Parsing/ParserMode/AbstractMode.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								ap23/web/doku/inc/Parsing/ParserMode/AbstractMode.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,40 @@ | ||||
| <?php | ||||
|  | ||||
| namespace dokuwiki\Parsing\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 \dokuwiki\Parsing\Lexer\Lexer $Lexer will be injected on loading FIXME this should be done by setter */ | ||||
|     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); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										68
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Acronym.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										68
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Acronym.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,68 @@ | ||||
| <?php | ||||
|  | ||||
| namespace dokuwiki\Parsing\ParserMode; | ||||
|  | ||||
| class Acronym extends AbstractMode | ||||
| { | ||||
|     // A list | ||||
|     protected $acronyms = array(); | ||||
|     protected $pattern = ''; | ||||
|  | ||||
|     /** | ||||
|      * Acronym constructor. | ||||
|      * | ||||
|      * @param string[] $acronyms | ||||
|      */ | ||||
|     public function __construct($acronyms) | ||||
|     { | ||||
|         usort($acronyms, array($this,'compare')); | ||||
|         $this->acronyms = $acronyms; | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function preConnect() | ||||
|     { | ||||
|         if (!count($this->acronyms)) return; | ||||
|  | ||||
|         $bound = '[\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]'; | ||||
|         $acronyms = array_map(['\\dokuwiki\\Parsing\\Lexer\\Lexer', 'escape'], $this->acronyms); | ||||
|         $this->pattern = '(?<=^|'.$bound.')(?:'.join('|', $acronyms).')(?='.$bound.')'; | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function connectTo($mode) | ||||
|     { | ||||
|         if (!count($this->acronyms)) return; | ||||
|  | ||||
|         if (strlen($this->pattern) > 0) { | ||||
|             $this->Lexer->addSpecialPattern($this->pattern, $mode, 'acronym'); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function getSort() | ||||
|     { | ||||
|         return 240; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * sort callback to order by string length descending | ||||
|      * | ||||
|      * @param string $a | ||||
|      * @param string $b | ||||
|      * | ||||
|      * @return int | ||||
|      */ | ||||
|     protected function compare($a, $b) | ||||
|     { | ||||
|         $a_len = strlen($a); | ||||
|         $b_len = strlen($b); | ||||
|         if ($a_len > $b_len) { | ||||
|             return -1; | ||||
|         } elseif ($a_len < $b_len) { | ||||
|             return 1; | ||||
|         } | ||||
|  | ||||
|         return 0; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										31
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Base.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Base.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,31 @@ | ||||
| <?php | ||||
|  | ||||
| namespace dokuwiki\Parsing\ParserMode; | ||||
|  | ||||
| class Base extends AbstractMode | ||||
| { | ||||
|  | ||||
|     /** | ||||
|      * Base constructor. | ||||
|      */ | ||||
|     public function __construct() | ||||
|     { | ||||
|         global $PARSER_MODES; | ||||
|  | ||||
|         $this->allowedModes = array_merge( | ||||
|             $PARSER_MODES['container'], | ||||
|             $PARSER_MODES['baseonly'], | ||||
|             $PARSER_MODES['paragraphs'], | ||||
|             $PARSER_MODES['formatting'], | ||||
|             $PARSER_MODES['substition'], | ||||
|             $PARSER_MODES['protected'], | ||||
|             $PARSER_MODES['disabled'] | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function getSort() | ||||
|     { | ||||
|         return 0; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										23
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Camelcaselink.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Camelcaselink.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,23 @@ | ||||
| <?php | ||||
|  | ||||
| namespace dokuwiki\Parsing\ParserMode; | ||||
|  | ||||
| class Camelcaselink extends AbstractMode | ||||
| { | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function connectTo($mode) | ||||
|     { | ||||
|         $this->Lexer->addSpecialPattern( | ||||
|             '\b[A-Z]+[a-z]+[A-Z][A-Za-z]*\b', | ||||
|             $mode, | ||||
|             'camelcaselink' | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function getSort() | ||||
|     { | ||||
|         return 290; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										25
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Code.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Code.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,25 @@ | ||||
| <?php | ||||
|  | ||||
| namespace dokuwiki\Parsing\ParserMode; | ||||
|  | ||||
| class Code extends AbstractMode | ||||
| { | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function connectTo($mode) | ||||
|     { | ||||
|         $this->Lexer->addEntryPattern('<code\b(?=.*</code>)', $mode, 'code'); | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function postConnect() | ||||
|     { | ||||
|         $this->Lexer->addExitPattern('</code>', 'code'); | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function getSort() | ||||
|     { | ||||
|         return 200; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										20
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Emaillink.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Emaillink.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,20 @@ | ||||
| <?php | ||||
|  | ||||
| namespace dokuwiki\Parsing\ParserMode; | ||||
|  | ||||
| class Emaillink extends AbstractMode | ||||
| { | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function connectTo($mode) | ||||
|     { | ||||
|         // pattern below is defined in inc/mail.php | ||||
|         $this->Lexer->addSpecialPattern('<'.PREG_PATTERN_VALID_EMAIL.'>', $mode, 'emaillink'); | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function getSort() | ||||
|     { | ||||
|         return 340; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										50
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Entity.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Entity.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,50 @@ | ||||
| <?php | ||||
|  | ||||
| namespace dokuwiki\Parsing\ParserMode; | ||||
|  | ||||
| use dokuwiki\Parsing\Lexer\Lexer; | ||||
|  | ||||
| class Entity extends AbstractMode | ||||
| { | ||||
|  | ||||
|     protected $entities = array(); | ||||
|     protected $pattern = ''; | ||||
|  | ||||
|     /** | ||||
|      * Entity constructor. | ||||
|      * @param string[] $entities | ||||
|      */ | ||||
|     public function __construct($entities) | ||||
|     { | ||||
|         $this->entities = $entities; | ||||
|     } | ||||
|  | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function preConnect() | ||||
|     { | ||||
|         if (!count($this->entities) || $this->pattern != '') return; | ||||
|  | ||||
|         $sep = ''; | ||||
|         foreach ($this->entities as $entity) { | ||||
|             $this->pattern .= $sep. Lexer::escape($entity); | ||||
|             $sep = '|'; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function connectTo($mode) | ||||
|     { | ||||
|         if (!count($this->entities)) return; | ||||
|  | ||||
|         if (strlen($this->pattern) > 0) { | ||||
|             $this->Lexer->addSpecialPattern($this->pattern, $mode, 'entity'); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function getSort() | ||||
|     { | ||||
|         return 260; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										25
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Eol.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Eol.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,25 @@ | ||||
| <?php | ||||
|  | ||||
| namespace dokuwiki\Parsing\ParserMode; | ||||
|  | ||||
| class Eol extends AbstractMode | ||||
| { | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function connectTo($mode) | ||||
|     { | ||||
|         $badModes = array('listblock','table'); | ||||
|         if (in_array($mode, $badModes)) { | ||||
|             return; | ||||
|         } | ||||
|         // see FS#1652, pattern extended to swallow preceding whitespace to avoid | ||||
|         // issues with lines that only contain whitespace | ||||
|         $this->Lexer->addSpecialPattern('(?:^[ \t]*)?\n', $mode, 'eol'); | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function getSort() | ||||
|     { | ||||
|         return 370; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										44
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Externallink.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Externallink.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,44 @@ | ||||
| <?php | ||||
|  | ||||
| namespace dokuwiki\Parsing\ParserMode; | ||||
|  | ||||
| class Externallink extends AbstractMode | ||||
| { | ||||
|     protected $schemes = array(); | ||||
|     protected $patterns = array(); | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function preConnect() | ||||
|     { | ||||
|         if (count($this->patterns)) return; | ||||
|  | ||||
|         $ltrs = '\w'; | ||||
|         $gunk = '/\#~:.?+=&%@!\-\[\]'; | ||||
|         $punc = '.:?\-;,'; | ||||
|         $host = $ltrs.$punc; | ||||
|         $any  = $ltrs.$gunk.$punc; | ||||
|  | ||||
|         $this->schemes = getSchemes(); | ||||
|         foreach ($this->schemes as $scheme) { | ||||
|             $this->patterns[] = '\b(?i)'.$scheme.'(?-i)://['.$any.']+?(?=['.$punc.']*[^'.$any.'])'; | ||||
|         } | ||||
|  | ||||
|         $this->patterns[] = '(?<=\s)(?i)www?(?-i)\.['.$host.']+?\.['.$host.']+?['.$any.']+?(?=['.$punc.']*[^'.$any.'])'; | ||||
|         $this->patterns[] = '(?<=\s)(?i)ftp?(?-i)\.['.$host.']+?\.['.$host.']+?['.$any.']+?(?=['.$punc.']*[^'.$any.'])'; | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function connectTo($mode) | ||||
|     { | ||||
|  | ||||
|         foreach ($this->patterns as $pattern) { | ||||
|             $this->Lexer->addSpecialPattern($pattern, $mode, 'externallink'); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function getSort() | ||||
|     { | ||||
|         return 330; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										25
									
								
								ap23/web/doku/inc/Parsing/ParserMode/File.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								ap23/web/doku/inc/Parsing/ParserMode/File.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,25 @@ | ||||
| <?php | ||||
|  | ||||
| namespace dokuwiki\Parsing\ParserMode; | ||||
|  | ||||
| class File extends AbstractMode | ||||
| { | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function connectTo($mode) | ||||
|     { | ||||
|         $this->Lexer->addEntryPattern('<file\b(?=.*</file>)', $mode, 'file'); | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function postConnect() | ||||
|     { | ||||
|         $this->Lexer->addExitPattern('</file>', 'file'); | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function getSort() | ||||
|     { | ||||
|         return 210; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										39
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Filelink.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Filelink.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,39 @@ | ||||
| <?php | ||||
|  | ||||
| namespace dokuwiki\Parsing\ParserMode; | ||||
|  | ||||
| class Filelink extends AbstractMode | ||||
| { | ||||
|  | ||||
|     protected $pattern; | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function preConnect() | ||||
|     { | ||||
|  | ||||
|         $ltrs = '\w'; | ||||
|         $gunk = '/\#~:.?+=&%@!\-'; | ||||
|         $punc = '.:?\-;,'; | ||||
|         $host = $ltrs.$punc; | ||||
|         $any  = $ltrs.$gunk.$punc; | ||||
|  | ||||
|         $this->pattern = '\b(?i)file(?-i)://['.$any.']+?['. | ||||
|             $punc.']*[^'.$any.']'; | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function connectTo($mode) | ||||
|     { | ||||
|         $this->Lexer->addSpecialPattern( | ||||
|             $this->pattern, | ||||
|             $mode, | ||||
|             'filelink' | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function getSort() | ||||
|     { | ||||
|         return 360; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										50
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Footnote.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Footnote.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,50 @@ | ||||
| <?php | ||||
|  | ||||
| namespace dokuwiki\Parsing\ParserMode; | ||||
|  | ||||
| class Footnote extends AbstractMode | ||||
| { | ||||
|  | ||||
|     /** | ||||
|      * Footnote constructor. | ||||
|      */ | ||||
|     public function __construct() | ||||
|     { | ||||
|         global $PARSER_MODES; | ||||
|  | ||||
|         $this->allowedModes = array_merge( | ||||
|             $PARSER_MODES['container'], | ||||
|             $PARSER_MODES['formatting'], | ||||
|             $PARSER_MODES['substition'], | ||||
|             $PARSER_MODES['protected'], | ||||
|             $PARSER_MODES['disabled'] | ||||
|         ); | ||||
|  | ||||
|         unset($this->allowedModes[array_search('footnote', $this->allowedModes)]); | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function connectTo($mode) | ||||
|     { | ||||
|         $this->Lexer->addEntryPattern( | ||||
|             '\x28\x28(?=.*\x29\x29)', | ||||
|             $mode, | ||||
|             'footnote' | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function postConnect() | ||||
|     { | ||||
|         $this->Lexer->addExitPattern( | ||||
|             '\x29\x29', | ||||
|             'footnote' | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function getSort() | ||||
|     { | ||||
|         return 150; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										115
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Formatting.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										115
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Formatting.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,115 @@ | ||||
| <?php | ||||
|  | ||||
| namespace dokuwiki\Parsing\ParserMode; | ||||
|  | ||||
| /** | ||||
|  * This class sets the markup for bold (=strong), | ||||
|  * italic (=emphasis), underline etc. | ||||
|  */ | ||||
| class Formatting extends AbstractMode | ||||
| { | ||||
|     protected $type; | ||||
|  | ||||
|     protected $formatting = array( | ||||
|         'strong' => array( | ||||
|             'entry' => '\*\*(?=.*\*\*)', | ||||
|             'exit' => '\*\*', | ||||
|             'sort' => 70 | ||||
|         ), | ||||
|  | ||||
|         'emphasis' => array( | ||||
|             'entry' => '//(?=[^\x00]*[^:])', //hack for bugs #384 #763 #1468 | ||||
|             'exit' => '//', | ||||
|             'sort' => 80 | ||||
|         ), | ||||
|  | ||||
|         'underline' => array( | ||||
|             'entry' => '__(?=.*__)', | ||||
|             'exit' => '__', | ||||
|             'sort' => 90 | ||||
|         ), | ||||
|  | ||||
|         'monospace' => array( | ||||
|             'entry' => '\x27\x27(?=.*\x27\x27)', | ||||
|             'exit' => '\x27\x27', | ||||
|             'sort' => 100 | ||||
|         ), | ||||
|  | ||||
|         'subscript' => array( | ||||
|             'entry' => '<sub>(?=.*</sub>)', | ||||
|             'exit' => '</sub>', | ||||
|             'sort' => 110 | ||||
|         ), | ||||
|  | ||||
|         'superscript' => array( | ||||
|             'entry' => '<sup>(?=.*</sup>)', | ||||
|             'exit' => '</sup>', | ||||
|             'sort' => 120 | ||||
|         ), | ||||
|  | ||||
|         'deleted' => array( | ||||
|             'entry' => '<del>(?=.*</del>)', | ||||
|             'exit' => '</del>', | ||||
|             'sort' => 130 | ||||
|         ), | ||||
|     ); | ||||
|  | ||||
|     /** | ||||
|      * @param string $type | ||||
|      */ | ||||
|     public function __construct($type) | ||||
|     { | ||||
|         global $PARSER_MODES; | ||||
|  | ||||
|         if (!array_key_exists($type, $this->formatting)) { | ||||
|             trigger_error('Invalid formatting type ' . $type, E_USER_WARNING); | ||||
|         } | ||||
|  | ||||
|         $this->type = $type; | ||||
|  | ||||
|         // formatting may contain other formatting but not it self | ||||
|         $modes = $PARSER_MODES['formatting']; | ||||
|         $key = array_search($type, $modes); | ||||
|         if (is_int($key)) { | ||||
|             unset($modes[$key]); | ||||
|         } | ||||
|  | ||||
|         $this->allowedModes = array_merge( | ||||
|             $modes, | ||||
|             $PARSER_MODES['substition'], | ||||
|             $PARSER_MODES['disabled'] | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function connectTo($mode) | ||||
|     { | ||||
|  | ||||
|         // Can't nest formatting in itself | ||||
|         if ($mode == $this->type) { | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         $this->Lexer->addEntryPattern( | ||||
|             $this->formatting[$this->type]['entry'], | ||||
|             $mode, | ||||
|             $this->type | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function postConnect() | ||||
|     { | ||||
|  | ||||
|         $this->Lexer->addExitPattern( | ||||
|             $this->formatting[$this->type]['exit'], | ||||
|             $this->type | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function getSort() | ||||
|     { | ||||
|         return $this->formatting[$this->type]['sort']; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										24
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Header.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Header.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,24 @@ | ||||
| <?php | ||||
|  | ||||
| namespace dokuwiki\Parsing\ParserMode; | ||||
|  | ||||
| class Header extends AbstractMode | ||||
| { | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function connectTo($mode) | ||||
|     { | ||||
|         //we're not picky about the closing ones, two are enough | ||||
|         $this->Lexer->addSpecialPattern( | ||||
|             '[ \t]*={2,}[^\n]+={2,}[ \t]*(?=\n)', | ||||
|             $mode, | ||||
|             'header' | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function getSort() | ||||
|     { | ||||
|         return 50; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										19
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Hr.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Hr.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,19 @@ | ||||
| <?php | ||||
|  | ||||
| namespace dokuwiki\Parsing\ParserMode; | ||||
|  | ||||
| class Hr extends AbstractMode | ||||
| { | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function connectTo($mode) | ||||
|     { | ||||
|         $this->Lexer->addSpecialPattern('\n[ \t]*-{4,}[ \t]*(?=\n)', $mode, 'hr'); | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function getSort() | ||||
|     { | ||||
|         return 160; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										27
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Html.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Html.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | ||||
| <?php | ||||
|  | ||||
| namespace dokuwiki\Parsing\ParserMode; | ||||
|  | ||||
| class Html extends AbstractMode | ||||
| { | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function connectTo($mode) | ||||
|     { | ||||
|         $this->Lexer->addEntryPattern('<html>(?=.*</html>)', $mode, 'html'); | ||||
|         $this->Lexer->addEntryPattern('<HTML>(?=.*</HTML>)', $mode, 'htmlblock'); | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function postConnect() | ||||
|     { | ||||
|         $this->Lexer->addExitPattern('</html>', 'html'); | ||||
|         $this->Lexer->addExitPattern('</HTML>', 'htmlblock'); | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function getSort() | ||||
|     { | ||||
|         return 190; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										20
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Internallink.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Internallink.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,20 @@ | ||||
| <?php | ||||
|  | ||||
| namespace dokuwiki\Parsing\ParserMode; | ||||
|  | ||||
| class Internallink extends AbstractMode | ||||
| { | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function connectTo($mode) | ||||
|     { | ||||
|         // Word boundaries? | ||||
|         $this->Lexer->addSpecialPattern("\[\[.*?\]\](?!\])", $mode, 'internallink'); | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function getSort() | ||||
|     { | ||||
|         return 300; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										19
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Linebreak.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Linebreak.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,19 @@ | ||||
| <?php | ||||
|  | ||||
| namespace dokuwiki\Parsing\ParserMode; | ||||
|  | ||||
| class Linebreak extends AbstractMode | ||||
| { | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function connectTo($mode) | ||||
|     { | ||||
|         $this->Lexer->addSpecialPattern('\x5C{2}(?:[ \t]|(?=\n))', $mode, 'linebreak'); | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function getSort() | ||||
|     { | ||||
|         return 140; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										44
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Listblock.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Listblock.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,44 @@ | ||||
| <?php | ||||
|  | ||||
| namespace dokuwiki\Parsing\ParserMode; | ||||
|  | ||||
| class Listblock extends AbstractMode | ||||
| { | ||||
|  | ||||
|     /** | ||||
|      * Listblock constructor. | ||||
|      */ | ||||
|     public function __construct() | ||||
|     { | ||||
|         global $PARSER_MODES; | ||||
|  | ||||
|         $this->allowedModes = array_merge( | ||||
|             $PARSER_MODES['formatting'], | ||||
|             $PARSER_MODES['substition'], | ||||
|             $PARSER_MODES['disabled'], | ||||
|             $PARSER_MODES['protected'] | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function connectTo($mode) | ||||
|     { | ||||
|         $this->Lexer->addEntryPattern('[ \t]*\n {2,}[\-\*]', $mode, 'listblock'); | ||||
|         $this->Lexer->addEntryPattern('[ \t]*\n\t{1,}[\-\*]', $mode, 'listblock'); | ||||
|  | ||||
|         $this->Lexer->addPattern('\n {2,}[\-\*]', 'listblock'); | ||||
|         $this->Lexer->addPattern('\n\t{1,}[\-\*]', 'listblock'); | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function postConnect() | ||||
|     { | ||||
|         $this->Lexer->addExitPattern('\n', 'listblock'); | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function getSort() | ||||
|     { | ||||
|         return 10; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										20
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Media.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Media.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,20 @@ | ||||
| <?php | ||||
|  | ||||
| namespace dokuwiki\Parsing\ParserMode; | ||||
|  | ||||
| class Media extends AbstractMode | ||||
| { | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function connectTo($mode) | ||||
|     { | ||||
|         // Word boundaries? | ||||
|         $this->Lexer->addSpecialPattern("\{\{(?:[^\}]|(?:\}[^\}]))+\}\}", $mode, 'media'); | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function getSort() | ||||
|     { | ||||
|         return 320; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										46
									
								
								ap23/web/doku/inc/Parsing/ParserMode/ModeInterface.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								ap23/web/doku/inc/Parsing/ParserMode/ModeInterface.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,46 @@ | ||||
| <?php | ||||
|  | ||||
| namespace dokuwiki\Parsing\ParserMode; | ||||
|  | ||||
| /** | ||||
|  * Defines a mode (syntax component) in the Parser | ||||
|  */ | ||||
| interface ModeInterface | ||||
| { | ||||
|     /** | ||||
|      * returns a number used to determine in which order modes are added | ||||
|      * | ||||
|      * @return int; | ||||
|      */ | ||||
|     public function getSort(); | ||||
|  | ||||
|     /** | ||||
|      * Called before any calls to connectTo | ||||
|      * | ||||
|      * @return void | ||||
|      */ | ||||
|     public function preConnect(); | ||||
|  | ||||
|     /** | ||||
|      * Connects the mode | ||||
|      * | ||||
|      * @param string $mode | ||||
|      * @return void | ||||
|      */ | ||||
|     public function connectTo($mode); | ||||
|  | ||||
|     /** | ||||
|      * Called after all calls to connectTo | ||||
|      * | ||||
|      * @return void | ||||
|      */ | ||||
|     public function postConnect(); | ||||
|  | ||||
|     /** | ||||
|      * Check if given mode is accepted inside this mode | ||||
|      * | ||||
|      * @param string $mode | ||||
|      * @return bool | ||||
|      */ | ||||
|     public function accepts($mode); | ||||
| } | ||||
							
								
								
									
										27
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Multiplyentity.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Multiplyentity.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | ||||
| <?php | ||||
|  | ||||
| namespace dokuwiki\Parsing\ParserMode; | ||||
|  | ||||
| /** | ||||
|  * Implements the 640x480 replacement | ||||
|  */ | ||||
| class Multiplyentity extends AbstractMode | ||||
| { | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function connectTo($mode) | ||||
|     { | ||||
|  | ||||
|         $this->Lexer->addSpecialPattern( | ||||
|             '(?<=\b)(?:[1-9]|\d{2,})[xX]\d+(?=\b)', | ||||
|             $mode, | ||||
|             'multiplyentity' | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function getSort() | ||||
|     { | ||||
|         return 270; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										19
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Nocache.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Nocache.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,19 @@ | ||||
| <?php | ||||
|  | ||||
| namespace dokuwiki\Parsing\ParserMode; | ||||
|  | ||||
| class Nocache extends AbstractMode | ||||
| { | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function connectTo($mode) | ||||
|     { | ||||
|         $this->Lexer->addSpecialPattern('~~NOCACHE~~', $mode, 'nocache'); | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function getSort() | ||||
|     { | ||||
|         return 40; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										19
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Notoc.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Notoc.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,19 @@ | ||||
| <?php | ||||
|  | ||||
| namespace dokuwiki\Parsing\ParserMode; | ||||
|  | ||||
| class Notoc extends AbstractMode | ||||
| { | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function connectTo($mode) | ||||
|     { | ||||
|         $this->Lexer->addSpecialPattern('~~NOTOC~~', $mode, 'notoc'); | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function getSort() | ||||
|     { | ||||
|         return 30; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										27
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Php.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Php.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | ||||
| <?php | ||||
|  | ||||
| namespace dokuwiki\Parsing\ParserMode; | ||||
|  | ||||
| class Php extends AbstractMode | ||||
| { | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function connectTo($mode) | ||||
|     { | ||||
|         $this->Lexer->addEntryPattern('<php>(?=.*</php>)', $mode, 'php'); | ||||
|         $this->Lexer->addEntryPattern('<PHP>(?=.*</PHP>)', $mode, 'phpblock'); | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function postConnect() | ||||
|     { | ||||
|         $this->Lexer->addExitPattern('</php>', 'php'); | ||||
|         $this->Lexer->addExitPattern('</PHP>', 'phpblock'); | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function getSort() | ||||
|     { | ||||
|         return 180; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										8
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Plugin.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Plugin.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | ||||
| <?php | ||||
|  | ||||
| namespace dokuwiki\Parsing\ParserMode; | ||||
|  | ||||
| /** | ||||
|  * @fixme do we need this anymore or could the syntax plugin inherit directly from abstract mode? | ||||
|  */ | ||||
| abstract class Plugin extends AbstractMode {} | ||||
							
								
								
									
										31
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Preformatted.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Preformatted.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,31 @@ | ||||
| <?php | ||||
|  | ||||
| namespace dokuwiki\Parsing\ParserMode; | ||||
|  | ||||
| class Preformatted extends AbstractMode | ||||
| { | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function connectTo($mode) | ||||
|     { | ||||
|         // Has hard coded awareness of lists... | ||||
|         $this->Lexer->addEntryPattern('\n  (?![\*\-])', $mode, 'preformatted'); | ||||
|         $this->Lexer->addEntryPattern('\n\t(?![\*\-])', $mode, 'preformatted'); | ||||
|  | ||||
|         // How to effect a sub pattern with the Lexer! | ||||
|         $this->Lexer->addPattern('\n  ', 'preformatted'); | ||||
|         $this->Lexer->addPattern('\n\t', 'preformatted'); | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function postConnect() | ||||
|     { | ||||
|         $this->Lexer->addExitPattern('\n', 'preformatted'); | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function getSort() | ||||
|     { | ||||
|         return 20; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										41
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Quote.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Quote.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,41 @@ | ||||
| <?php | ||||
|  | ||||
| namespace dokuwiki\Parsing\ParserMode; | ||||
|  | ||||
| class Quote extends AbstractMode | ||||
| { | ||||
|  | ||||
|     /** | ||||
|      * Quote constructor. | ||||
|      */ | ||||
|     public function __construct() | ||||
|     { | ||||
|         global $PARSER_MODES; | ||||
|  | ||||
|         $this->allowedModes = array_merge( | ||||
|             $PARSER_MODES['formatting'], | ||||
|             $PARSER_MODES['substition'], | ||||
|             $PARSER_MODES['disabled'], | ||||
|             $PARSER_MODES['protected'] | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function connectTo($mode) | ||||
|     { | ||||
|         $this->Lexer->addEntryPattern('\n>{1,}', $mode, 'quote'); | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function postConnect() | ||||
|     { | ||||
|         $this->Lexer->addPattern('\n>{1,}', 'quote'); | ||||
|         $this->Lexer->addExitPattern('\n', 'quote'); | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function getSort() | ||||
|     { | ||||
|         return 220; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										51
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Quotes.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Quotes.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,51 @@ | ||||
| <?php | ||||
|  | ||||
| namespace dokuwiki\Parsing\ParserMode; | ||||
|  | ||||
| class Quotes extends AbstractMode | ||||
| { | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function connectTo($mode) | ||||
|     { | ||||
|         global $conf; | ||||
|  | ||||
|         $ws   =  '\s/\#~:+=&%@\-\x28\x29\]\[{}><"\'';   // whitespace | ||||
|         $punc =  ';,\.?!'; | ||||
|  | ||||
|         if ($conf['typography'] == 2) { | ||||
|             $this->Lexer->addSpecialPattern( | ||||
|                 "(?<=^|[$ws])'(?=[^$ws$punc])", | ||||
|                 $mode, | ||||
|                 'singlequoteopening' | ||||
|             ); | ||||
|             $this->Lexer->addSpecialPattern( | ||||
|                 "(?<=^|[^$ws]|[$punc])'(?=$|[$ws$punc])", | ||||
|                 $mode, | ||||
|                 'singlequoteclosing' | ||||
|             ); | ||||
|             $this->Lexer->addSpecialPattern( | ||||
|                 "(?<=^|[^$ws$punc])'(?=$|[^$ws$punc])", | ||||
|                 $mode, | ||||
|                 'apostrophe' | ||||
|             ); | ||||
|         } | ||||
|  | ||||
|         $this->Lexer->addSpecialPattern( | ||||
|             "(?<=^|[$ws])\"(?=[^$ws$punc])", | ||||
|             $mode, | ||||
|             'doublequoteopening' | ||||
|         ); | ||||
|         $this->Lexer->addSpecialPattern( | ||||
|             "\"", | ||||
|             $mode, | ||||
|             'doublequoteclosing' | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function getSort() | ||||
|     { | ||||
|         return 280; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										19
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Rss.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Rss.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,19 @@ | ||||
| <?php | ||||
|  | ||||
| namespace dokuwiki\Parsing\ParserMode; | ||||
|  | ||||
| class Rss extends AbstractMode | ||||
| { | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function connectTo($mode) | ||||
|     { | ||||
|         $this->Lexer->addSpecialPattern("\{\{rss>[^\}]+\}\}", $mode, 'rss'); | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function getSort() | ||||
|     { | ||||
|         return 310; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										48
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Smiley.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Smiley.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,48 @@ | ||||
| <?php | ||||
|  | ||||
| namespace dokuwiki\Parsing\ParserMode; | ||||
|  | ||||
| use dokuwiki\Parsing\Lexer\Lexer; | ||||
|  | ||||
| class Smiley extends AbstractMode | ||||
| { | ||||
|     protected $smileys = array(); | ||||
|     protected $pattern = ''; | ||||
|  | ||||
|     /** | ||||
|      * Smiley constructor. | ||||
|      * @param string[] $smileys | ||||
|      */ | ||||
|     public function __construct($smileys) | ||||
|     { | ||||
|         $this->smileys = $smileys; | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function preConnect() | ||||
|     { | ||||
|         if (!count($this->smileys) || $this->pattern != '') return; | ||||
|  | ||||
|         $sep = ''; | ||||
|         foreach ($this->smileys as $smiley) { | ||||
|             $this->pattern .= $sep.'(?<=\W|^)'. Lexer::escape($smiley).'(?=\W|$)'; | ||||
|             $sep = '|'; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function connectTo($mode) | ||||
|     { | ||||
|         if (!count($this->smileys)) return; | ||||
|  | ||||
|         if (strlen($this->pattern) > 0) { | ||||
|             $this->Lexer->addSpecialPattern($this->pattern, $mode, 'smiley'); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function getSort() | ||||
|     { | ||||
|         return 230; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										47
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Table.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Table.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,47 @@ | ||||
| <?php | ||||
|  | ||||
| namespace dokuwiki\Parsing\ParserMode; | ||||
|  | ||||
| class Table extends AbstractMode | ||||
| { | ||||
|  | ||||
|     /** | ||||
|      * Table constructor. | ||||
|      */ | ||||
|     public function __construct() | ||||
|     { | ||||
|         global $PARSER_MODES; | ||||
|  | ||||
|         $this->allowedModes = array_merge( | ||||
|             $PARSER_MODES['formatting'], | ||||
|             $PARSER_MODES['substition'], | ||||
|             $PARSER_MODES['disabled'], | ||||
|             $PARSER_MODES['protected'] | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function connectTo($mode) | ||||
|     { | ||||
|         $this->Lexer->addEntryPattern('[\t ]*\n\^', $mode, 'table'); | ||||
|         $this->Lexer->addEntryPattern('[\t ]*\n\|', $mode, 'table'); | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function postConnect() | ||||
|     { | ||||
|         $this->Lexer->addPattern('\n\^', 'table'); | ||||
|         $this->Lexer->addPattern('\n\|', 'table'); | ||||
|         $this->Lexer->addPattern('[\t ]*:::[\t ]*(?=[\|\^])', 'table'); | ||||
|         $this->Lexer->addPattern('[\t ]+', 'table'); | ||||
|         $this->Lexer->addPattern('\^', 'table'); | ||||
|         $this->Lexer->addPattern('\|', 'table'); | ||||
|         $this->Lexer->addExitPattern('\n', 'table'); | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function getSort() | ||||
|     { | ||||
|         return 60; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										28
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Unformatted.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Unformatted.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,28 @@ | ||||
| <?php | ||||
|  | ||||
| namespace dokuwiki\Parsing\ParserMode; | ||||
|  | ||||
| class Unformatted extends AbstractMode | ||||
| { | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function connectTo($mode) | ||||
|     { | ||||
|         $this->Lexer->addEntryPattern('<nowiki>(?=.*</nowiki>)', $mode, 'unformatted'); | ||||
|         $this->Lexer->addEntryPattern('%%(?=.*%%)', $mode, 'unformattedalt'); | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function postConnect() | ||||
|     { | ||||
|         $this->Lexer->addExitPattern('</nowiki>', 'unformatted'); | ||||
|         $this->Lexer->addExitPattern('%%', 'unformattedalt'); | ||||
|         $this->Lexer->mapHandler('unformattedalt', 'unformatted'); | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function getSort() | ||||
|     { | ||||
|         return 170; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										31
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Windowssharelink.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Windowssharelink.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,31 @@ | ||||
| <?php | ||||
|  | ||||
| namespace dokuwiki\Parsing\ParserMode; | ||||
|  | ||||
| class Windowssharelink extends AbstractMode | ||||
| { | ||||
|  | ||||
|     protected $pattern; | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function preConnect() | ||||
|     { | ||||
|         $this->pattern = "\\\\\\\\\w+?(?:\\\\[\w\-$]+)+"; | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function connectTo($mode) | ||||
|     { | ||||
|         $this->Lexer->addSpecialPattern( | ||||
|             $this->pattern, | ||||
|             $mode, | ||||
|             'windowssharelink' | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function getSort() | ||||
|     { | ||||
|         return 350; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										52
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Wordblock.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								ap23/web/doku/inc/Parsing/ParserMode/Wordblock.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,52 @@ | ||||
| <?php | ||||
|  | ||||
| namespace dokuwiki\Parsing\ParserMode; | ||||
|  | ||||
| use dokuwiki\Parsing\Lexer\Lexer; | ||||
|  | ||||
| /** | ||||
|  * @fixme is this actually used? | ||||
|  */ | ||||
| class Wordblock extends AbstractMode | ||||
| { | ||||
|     protected $badwords = array(); | ||||
|     protected $pattern = ''; | ||||
|  | ||||
|     /** | ||||
|      * Wordblock constructor. | ||||
|      * @param $badwords | ||||
|      */ | ||||
|     public function __construct($badwords) | ||||
|     { | ||||
|         $this->badwords = $badwords; | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function preConnect() | ||||
|     { | ||||
|  | ||||
|         if (count($this->badwords) == 0 || $this->pattern != '') { | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         $sep = ''; | ||||
|         foreach ($this->badwords as $badword) { | ||||
|             $this->pattern .= $sep.'(?<=\b)(?i)'. Lexer::escape($badword).'(?-i)(?=\b)'; | ||||
|             $sep = '|'; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function connectTo($mode) | ||||
|     { | ||||
|         if (strlen($this->pattern) > 0) { | ||||
|             $this->Lexer->addSpecialPattern($this->pattern, $mode, 'wordblock'); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /** @inheritdoc */ | ||||
|     public function getSort() | ||||
|     { | ||||
|         return 250; | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user