Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions block/TableTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@ protected function consumeTable($lines, $current)
'cols' => [],
'rows' => [],
];
$beginsWithPipe = $lines[$current][0] === '|';
for ($i = $current, $count = count($lines); $i < $count; $i++) {
$line = rtrim($lines[$i]);
$line = trim($lines[$i]);

// extract alignment from second line
if ($i == $current+1) {
Expand All @@ -65,7 +64,7 @@ protected function consumeTable($lines, $current)

continue;
}
if ($line === '' || $beginsWithPipe && $line[0] !== '|') {
if ($line === '' || substr($lines[$i], 0, 4) === ' ') {
break;
}
if ($line[0] === '|') {
Expand Down
2 changes: 1 addition & 1 deletion tests/extra-data/tables.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,6 @@ <h2>Tables</h2>
</thead>
<tbody>
<tr><td align="left">3 </td><td>4</td></tr>
<tr><td align="left">3 </td><td>4</td></tr>
</tbody>
</table>
<p>3 | 4</p>
2 changes: 1 addition & 1 deletion tests/github-data/tables.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ <h2>Tables</h2>
</thead>
<tbody>
<tr><td align="left">3 </td><td>4</td></tr>
<tr><td align="left">3 </td><td>4</td></tr>
</tbody>
</table>
<p>3 | 4</p>
<table>
<thead>
<tr><th>Table </th><th>With </th><th>Empty </th><th>Cells</th></tr>
Expand Down