summaryrefslogtreecommitdiff
path: root/inc/parser
diff options
context:
space:
mode:
Diffstat (limited to 'inc/parser')
-rw-r--r--inc/parser/handler.php27
-rw-r--r--inc/parser/parser.php3
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');