diff --git a/block/TableTrait.php b/block/TableTrait.php index 59351dd..c7fc095 100644 --- a/block/TableTrait.php +++ b/block/TableTrait.php @@ -91,7 +91,8 @@ protected function renderTable($block) $first = true; foreach($block['rows'] as $row) { $this->_tableCellTag = $first ? 'th' : 'td'; - $align = empty($this->_tableCellAlign[$this->_tableCellCount]) ? '' : ' align="' . $this->_tableCellAlign[$this->_tableCellCount++] . '"'; + $align = empty($this->_tableCellAlign[$this->_tableCellCount]) ? '' : ' align="' . $this->_tableCellAlign[$this->_tableCellCount] . '"'; + $this->_tableCellCount++; $tds = "<$this->_tableCellTag$align>" . trim($this->renderAbsy($this->parseInline($row))) . "_tableCellTag>"; // TODO move this to the consume step $content .= "$tds\n"; if ($first) { @@ -109,7 +110,8 @@ protected function renderTable($block) protected function parseTd($markdown) { if (isset($this->context[1]) && $this->context[1] === 'table') { - $align = empty($this->_tableCellAlign[$this->_tableCellCount]) ? '' : ' align="' . $this->_tableCellAlign[$this->_tableCellCount++] . '"'; + $align = empty($this->_tableCellAlign[$this->_tableCellCount]) ? '' : ' align="' . $this->_tableCellAlign[$this->_tableCellCount] . '"'; + $this->_tableCellCount++; return [['text', "_tableCellTag><$this->_tableCellTag$align>"], isset($markdown[1]) && $markdown[1] === ' ' ? 2 : 1]; // TODO make a absy node } return [['text', $markdown[0]], 1]; diff --git a/tests/extra-data/tables.html b/tests/extra-data/tables.html index 1c5b0fa..1011506 100644 --- a/tests/extra-data/tables.html +++ b/tests/extra-data/tables.html @@ -37,12 +37,12 @@

Tables

- + - - - + + +
Left-Aligned Center Aligned Right Aligned
Default-Align Left-Aligned Center Aligned Right Aligned
col 3 is some wordy text $1600
col 2 is centered $12
zebra stripes are neat $1
1 col 3 is some wordy text $1600
2 col 2 is centered $12
3 zebra stripes are neat $1
diff --git a/tests/extra-data/tables.md b/tests/extra-data/tables.md index eab866d..2d6f512 100644 --- a/tests/extra-data/tables.md +++ b/tests/extra-data/tables.md @@ -21,11 +21,11 @@ Content Cell | Content Cell | Help | **Display the** help window.| | Close | _Closes_ a window | -| Left-Aligned | Center Aligned | Right Aligned | -| :------------ |:---------------:| -----:| -| col 3 is | some wordy text | $1600 | -| col 2 is | centered | $12 | -| zebra stripes | are neat | $1 | +| Default-Align | Left-Aligned | Center Aligned | Right Aligned | +| ------------- | :------------ |:---------------:| -----:| +| 1 | col 3 is | some wordy text | $1600 | +| 2 | col 2 is | centered | $12 | +| 3 | zebra stripes | are neat | $1 | Simple | Table diff --git a/tests/github-data/tables.html b/tests/github-data/tables.html index 0e39425..09805bb 100644 --- a/tests/github-data/tables.html +++ b/tests/github-data/tables.html @@ -37,12 +37,12 @@

Tables

- + - - - + + +
Left-Aligned Center Aligned Right Aligned
Default-Align Left-Aligned Center Aligned Right Aligned
col 3 is some wordy text $1600
col 2 is centered $12
zebra stripes are neat $1
1 col 3 is some wordy text $1600
2 col 2 is centered $12
3 zebra stripes are neat $1
diff --git a/tests/github-data/tables.md b/tests/github-data/tables.md index f23def3..82c4382 100644 --- a/tests/github-data/tables.md +++ b/tests/github-data/tables.md @@ -21,11 +21,11 @@ Content Cell | Content Cell | Help | **Display the** help window.| | Close | _Closes_ a window | -| Left-Aligned | Center Aligned | Right Aligned | -| :------------ |:---------------:| -----:| -| col 3 is | some wordy text | $1600 | -| col 2 is | centered | $12 | -| zebra stripes | are neat | $1 | +| Default-Align | Left-Aligned | Center Aligned | Right Aligned | +| ------------- | :------------ |:---------------:| -----:| +| 1 | col 3 is | some wordy text | $1600 | +| 2 | col 2 is | centered | $12 | +| 3 | zebra stripes | are neat | $1 | Simple | Table