Skip to content

Commit

Permalink
Fix HTML Merged Renderer
Browse files Browse the repository at this point in the history
Stray </tbody> tags present when lines removed from version 2.
  • Loading branch information
DigiLive authored and DigiLive committed Nov 21, 2020
1 parent cf516d1 commit 07da484
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/jblond/Diff/Renderer/Html/Merged.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ function ($removedParts) use ($addedParts) {
*/
public function generateBlockFooter(array $changes): string
{
return '</tbody>';
return $changes['tag'] != 'delete' ? '</tbody>' : '';
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/resources/htmlMerged.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</tr><tr>
<th class="" title="">7</th>
<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>
</tr></tbody></tbody><tbody class="ChangeEqual"><tr>
</tr></tbody><tbody class="ChangeEqual"><tr>
<th class="ChangeDelete" title="Lines deleted at Version2:
8: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;h2&gt;This line is removed from version2.&lt;/h2&gt;
">8</th>
Expand Down

0 comments on commit 07da484

Please sign in to comment.