diff options
Diffstat (limited to 'inc/parser/handler.php')
-rw-r--r-- | inc/parser/handler.php | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/inc/parser/handler.php b/inc/parser/handler.php index 9011554bc..61c143bae 100644 --- a/inc/parser/handler.php +++ b/inc/parser/handler.php @@ -789,9 +789,24 @@ class Doku_Handler_Nest { } function process() { + // merge consecutive cdata + $unmerged_calls = $this->calls; + $this->calls = array(); + + foreach ($unmerged_calls as $call) $this->addCall($call); + $first_call = reset($this->calls); $this->CallWriter->writeCall(array("nest", array($this->calls), $first_call[2])); } + + function addCall($call) { + $key = count($this->calls); + if ($key and ($call[0] == 'cdata') and ($this->calls[$key-1][0] == 'cdata')) { + $this->calls[$key-1][1][0] .= $call[1][0]; + } else { + $this->calls[] = $call; + } + } } class Doku_Handler_List { @@ -1060,7 +1075,6 @@ class Doku_Handler_Quote { // Probably not needed but just in case... function writeCalls($calls) { $this->calls = array_merge($this->calls, $calls); -# $this->CallWriter->writeCalls($this->calls); } function finalise() { @@ -1156,7 +1170,6 @@ class Doku_Handler_Table { // Probably not needed but just in case... function writeCalls($calls) { $this->calls = array_merge($this->calls, $calls); -# $this->CallWriter->writeCalls($this->calls); } function finalise() { @@ -1577,7 +1590,7 @@ class Doku_Handler_Block { }else{ //if this is just a single eol make a space from it - $this->calls[] = array('cdata',array(DOKU_PARSER_EOL), $call[2]); + $this->addCall(array('cdata',array(DOKU_PARSER_EOL), $call[2])); } } @@ -1623,7 +1636,7 @@ class Doku_Handler_Block { } if ( $storeCall ) { - $this->calls[] = $call; + $this->addCall($call); } } @@ -1640,7 +1653,7 @@ class Doku_Handler_Block { $this->atStart = false; $this->inParagraph = true; } else { - $this->calls[] = $call; + $this->addCall($call); $this->atStart = false; } @@ -1677,6 +1690,15 @@ class Doku_Handler_Block { $this->atStart = $state[0]; $this->inParagraph = $state[1]; } + + function addCall($call) { + $key = count($this->calls); + if ($key and ($call[0] == 'cdata') and ($this->calls[$key-1][0] == 'cdata')) { + $this->calls[$key-1][1][0] .= $call[1][0]; + } else { + $this->calls[] = $call; + } + } } //Setup VIM: ex: et ts=4 enc=utf-8 : |