diff options
author | Andreas Gohr <gohr@cosmocode.de> | 2005-11-03 17:26:30 +0100 |
---|---|---|
committer | Andreas Gohr <gohr@cosmocode.de> | 2005-11-03 17:26:30 +0100 |
commit | 9ab75d9e5b40b2a68d2904f6f190a30326f0378a (patch) | |
tree | 8f79976603ec8f5f359133b7ca5c0517ecf86b7c /inc | |
parent | ba618d0d83f3a770e741e1f1950dea818de6ab46 (diff) | |
download | rpg-9ab75d9e5b40b2a68d2904f6f190a30326f0378a.tar.gz rpg-9ab75d9e5b40b2a68d2904f6f190a30326f0378a.tar.bz2 |
Table Syntax fixes #280 #591
darcs-hash:20051103162630-6e07b-21520008f556114f8273307e7d6d33795488b1d2.gz
Diffstat (limited to 'inc')
-rw-r--r-- | inc/parser/handler.php | 27 | ||||
-rw-r--r-- | inc/parser/parser.php | 3 |
2 files changed, 25 insertions, 5 deletions
diff --git a/inc/parser/handler.php b/inc/parser/handler.php index 805449ea5..61185b046 100644 --- a/inc/parser/handler.php +++ b/inc/parser/handler.php @@ -523,7 +523,11 @@ class Doku_Handler { break; case DOKU_LEXER_MATCHED: - if ( preg_match('/.{2}/',$match) ) { + if ( $match == ' ' ){ + $this->_addCall('cdata', array($match), $pos); + } else if ( preg_match('/\t+/',$match) ) { + $this->_addCall('table_align', array($match), $pos); + } else if ( preg_match('/ {2,}/',$match) ) { $this->_addCall('table_align', array($match), $pos); } else if ( $match == "\n|" ) { $this->_addCall('table_row', array(), $pos); @@ -1135,7 +1139,7 @@ class Doku_Handler_Table { // Now convert the whitespace back to cdata $this->tableCalls[$key][0] = 'cdata'; - + } else if ( $call[0] == 'colspan' ) { $this->tableCalls[$key-1][1][0] = FALSE; @@ -1158,11 +1162,26 @@ class Doku_Handler_Table { $toDelete[] = $key+1; } } - + + + // condense cdata + $cnt = count($this->tableCalls); + for( $key = 0; $key < $cnt; $key++){ + if($this->tableCalls[$key][0] == 'cdata'){ + $ckey = $key; + $key++; + while($this->tableCalls[$key][0] == 'cdata'){ + $this->tableCalls[$ckey][1][0] .= $this->tableCalls[$key][1][0]; + $toDelete[] = $key; + $key++; + } + continue; + } + } + foreach ( $toDelete as $delete ) { unset($this->tableCalls[$delete]); } - $this->tableCalls = array_values($this->tableCalls); } } diff --git a/inc/parser/parser.php b/inc/parser/parser.php index 9cc257c02..7a3342fbf 100644 --- a/inc/parser/parser.php +++ b/inc/parser/parser.php @@ -464,7 +464,8 @@ class Doku_Parser_Mode_table extends Doku_Parser_Mode { function postConnect() { $this->Lexer->addPattern('\n\^','table'); $this->Lexer->addPattern('\n\|','table'); - $this->Lexer->addPattern(' {2,}','table'); + #$this->Lexer->addPattern(' {2,}','table'); + $this->Lexer->addPattern('[\t ]+','table'); $this->Lexer->addPattern('\^','table'); $this->Lexer->addPattern('\|','table'); $this->Lexer->addExitPattern('\n','table'); |