diff options
author | Adrian Lang <lang@cosmocode.de> | 2010-03-26 13:16:46 +0100 |
---|---|---|
committer | Adrian Lang <lang@cosmocode.de> | 2010-03-26 13:22:54 +0100 |
commit | 0139312b0d39e61bdff7318a0c092eb20b208a78 (patch) | |
tree | d4b204bbf6dd16cc176daafe243aead474fae2df | |
parent | 7d54a99ffcfd517bfc9bc5e18eb3f87922617077 (diff) | |
download | rpg-0139312b0d39e61bdff7318a0c092eb20b208a78.tar.gz rpg-0139312b0d39e61bdff7318a0c092eb20b208a78.tar.bz2 |
Better code syntax parsing, less E_NOTICE
-rw-r--r-- | inc/parser/handler.php | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/inc/parser/handler.php b/inc/parser/handler.php index b5d2baaab..8639c5ad8 100644 --- a/inc/parser/handler.php +++ b/inc/parser/handler.php @@ -344,21 +344,16 @@ class Doku_Handler { function code($match, $state, $pos, $type='code') { if ( $state == DOKU_LEXER_UNMATCHED ) { $matches = explode('>',$match,2); - $matches[0] = trim($matches[0]); - - list($language,$filename) = explode(' ',$matches[0],2); - $language = trim($language); - $filename = trim($filename); - if ( $language == '' ) $language = null; - if ( $language == '-' ) $language = null; - if ( $filename == '' ) $filename = null; - # We shortcut html here. - if($language == 'html') $language = 'html4strict'; - $this->_addCall( - $type, - array($matches[1],$language,$filename), - $pos - ); + + $param = preg_split('/\s+/', $matches[0], 2, PREG_SPLIT_NO_EMPTY); + while(count($param) < 2) array_push($param, null); + + // We shortcut html here. + if ($param[0] == 'html') $param[0] = 'html4strict'; + if ($param[0] == '-') $param[0] = null; + array_unshift($param, $matches[1]); + + $this->_addCall($type, $param, $pos); } return true; } |