diff options
author | Andreas Gohr <andi@splitbrain.org> | 2006-03-17 19:26:31 +0100 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2006-03-17 19:26:31 +0100 |
commit | 901c1c871d716eed41ae132c0782127d07a15fb9 (patch) | |
tree | 7b51b1200b1a8bcb03bbc670dc1f8957f6d53809 | |
parent | 4300be58a56abaf698345b85ac65c5a797847bd9 (diff) | |
download | rpg-901c1c871d716eed41ae132c0782127d07a15fb9.tar.gz rpg-901c1c871d716eed41ae132c0782127d07a15fb9.tar.bz2 |
make sure the parser works if acronym file is missing #716
Parser don't longer breaks if no smileys, acronyms or entities are configured
darcs-hash:20060317182631-7ad00-090248bae8cdeaa19127251e46dfaef80ef49f58.gz
-rw-r--r-- | inc/parser/parser.php | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/inc/parser/parser.php b/inc/parser/parser.php index 0e921030b..a99d8da34 100644 --- a/inc/parser/parser.php +++ b/inc/parser/parser.php @@ -624,12 +624,16 @@ class Doku_Parser_Mode_acronym extends Doku_Parser_Mode { } function preConnect() { + if(!count($this->acronyms)) return; + $bound = '[\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]'; $acronyms = array_map('Doku_Lexer_Escape',$this->acronyms); $this->pattern = '(?<=^|'.$bound.')(?:'.join('|',$acronyms).')(?='.$bound.')'; } function connectTo($mode) { + if(!count($this->acronyms)) return; + if ( strlen($this->pattern) > 0 ) { $this->Lexer->addSpecialPattern($this->pattern,$mode,'acronym'); } @@ -651,6 +655,8 @@ class Doku_Parser_Mode_smiley extends Doku_Parser_Mode { } function preConnect() { + if(!count($this->smileys)) return; + $sep = ''; foreach ( $this->smileys as $smiley ) { $this->pattern .= $sep.Doku_Lexer_Escape($smiley); @@ -659,6 +665,8 @@ class Doku_Parser_Mode_smiley extends Doku_Parser_Mode { } function connectTo($mode) { + if(!count($this->smileys)) return; + if ( strlen($this->pattern) > 0 ) { $this->Lexer->addSpecialPattern($this->pattern,$mode,'smiley'); } @@ -718,6 +726,8 @@ class Doku_Parser_Mode_entity extends Doku_Parser_Mode { } function preConnect() { + if(!count($this->entities)) return; + $sep = ''; foreach ( $this->entities as $entity ) { $this->pattern .= $sep.Doku_Lexer_Escape($entity); @@ -726,6 +736,8 @@ class Doku_Parser_Mode_entity extends Doku_Parser_Mode { } function connectTo($mode) { + if(!count($this->entities)) return; + if ( strlen($this->pattern) > 0 ) { $this->Lexer->addSpecialPattern($this->pattern,$mode,'entity'); } |