From 9ab75d9e5b40b2a68d2904f6f190a30326f0378a Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Thu, 3 Nov 2005 17:26:30 +0100 Subject: Table Syntax fixes #280 #591 darcs-hash:20051103162630-6e07b-21520008f556114f8273307e7d6d33795488b1d2.gz --- inc/parser/handler.php | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'inc/parser/handler.php') 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); } } -- cgit v1.2.3