Skip to content

Commit 07da484

Browse files
committed
Fix HTML Merged Renderer
Stray </tbody> tags present when lines removed from version 2.
1 parent cf516d1 commit 07da484

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/jblond/Diff/Renderer/Html/Merged.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ function ($removedParts) use ($addedParts) {
253253
*/
254254
public function generateBlockFooter(array $changes): string
255255
{
256-
return '</tbody>';
256+
return $changes['tag'] != 'delete' ? '</tbody>' : '';
257257
}
258258

259259
/**

tests/resources/htmlMerged.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
</tr><tr>
2525
<th class="" title="">7</th>
2626
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;h1&gt;This is demo content to show features of the php-diff package.&lt;/h1&gt;</td>
27-
</tr></tbody></tbody><tbody class="ChangeEqual"><tr>
27+
</tr></tbody><tbody class="ChangeEqual"><tr>
2828
<th class="ChangeDelete" title="Lines deleted at Version2:
2929
8: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;h2&gt;This line is removed from version2.&lt;/h2&gt;
3030
">8</th>

0 commit comments

Comments
 (0)