summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2013-10-13 01:08:55 -0700
committerAndreas Gohr <andi@splitbrain.org>2013-10-13 01:08:55 -0700
commitb0d8bc5fa3fb8530225f01864c73542edff7be1c (patch)
treecd2dc294ac7557df1499861115febe7c0d71d602
parent6d18d1a863fdcaea8ed2e8009fcc2a2c52a1fbba (diff)
parent0d9a72ff5d870d72772f5f6b4b83b8ee0b4a1f05 (diff)
downloadrpg-b0d8bc5fa3fb8530225f01864c73542edff7be1c.tar.gz
rpg-b0d8bc5fa3fb8530225f01864c73542edff7be1c.tar.bz2
Merge pull request #344 from splitbrain/tablewithonlyrowspan
Display tablecell with rowspan at first row as empty cell. Fixes FS#2810
-rw-r--r--_test/tests/inc/parser/parser_table.test.php58
-rw-r--r--inc/parser/handler.php3
2 files changed, 60 insertions, 1 deletions
diff --git a/_test/tests/inc/parser/parser_table.test.php b/_test/tests/inc/parser/parser_table.test.php
index 96789c38c..542a307b8 100644
--- a/_test/tests/inc/parser/parser_table.test.php
+++ b/_test/tests/inc/parser/parser_table.test.php
@@ -270,6 +270,64 @@ def');
);
$this->assertEquals(array_map('stripbyteindex',$this->H->calls),$calls);
}
+
+ function testCellRowSpanFirstRow() {
+ $this->P->addMode('table',new Doku_Parser_Mode_Table());
+ $this->P->parse('
+abc
+|::: ^ d:::^:::| ::: |
+| b ^ e | | ::: |
+|c ^ ::: | |:::|
+def');
+
+ $calls = array (
+ array('document_start',array()),
+ array('p_open',array()),
+ array('cdata',array("\n\nabc")),
+ array('p_close',array()),
+ array('table_open',array(4, 3, 6)),
+ array('tablerow_open',array()),
+ array('tablecell_open',array(1,NULL,1)),
+ array('cdata',array('')),
+ array('tablecell_close',array()),
+ array('tableheader_open',array(1,'right',1)),
+ array('cdata',array(' d:::')),
+ array('tableheader_close',array()),
+ array('tableheader_open',array(1,NULL,1)),
+ array('cdata',array('')),
+ array('tableheader_close',array()),
+ array('tablecell_open',array(1,NULL,3)),
+ array('cdata',array('')),
+ array('tablecell_close',array()),
+ array('tablerow_close',array()),
+ array('tablerow_open',array()),
+ array('tablecell_open',array(1,NULL,1)),
+ array('cdata',array(' b ')),
+ array('tablecell_close',array()),
+ array('tableheader_open',array(1,'left',2)),
+ array('cdata',array(' e ')),
+ array('tableheader_close',array()),
+ array('tablecell_open',array(1,NULL,1)),
+ array('cdata',array(' ')),
+ array('tablecell_close',array()),
+ array('tablerow_close',array()),
+ array('tablerow_open',array()),
+ array('tablecell_open',array(1,'left',1)),
+ array('cdata',array('c ')),
+ array('tablecell_close',array()),
+ array('tablecell_open',array(1,NULL,1)),
+ array('cdata',array(' ')),
+ array('tablecell_close',array()),
+ array('tablerow_close',array()),
+
+ array('table_close',array(69)),
+ array('p_open',array()),
+ array('cdata',array('def')),
+ array('p_close',array()),
+ array('document_end',array()),
+ );
+ $this->assertEquals(array_map('stripbyteindex',$this->H->calls),$calls);
+ }
function testCellAlignmentFormatting() {
$this->P->addMode('table',new Doku_Parser_Mode_Table());
diff --git a/inc/parser/handler.php b/inc/parser/handler.php
index b72f051ae..1de981b48 100644
--- a/inc/parser/handler.php
+++ b/inc/parser/handler.php
@@ -1371,7 +1371,8 @@ class Doku_Handler_Table {
if (is_null($spanning_cell)) {
// No spanning cell found, so convert this cell to
// an empty one to avoid broken tables
- $this->tableCells[$key][1][1] = '';
+ $this->tableCalls[$key][0] = 'cdata';
+ $this->tableCalls[$key][1][0] = '';
continue;
}
$this->tableCalls[$cellKey[$spanning_cell][$lastCell]][1][2]++;