Skip to content

Releases: caxy/php-htmldiff

0.0.12

09 Dec 22:22
Compare
Choose a tag to compare
0.0.12 Pre-release
Pre-release
Merge pull request #20 from caxy/feature-list_diffing-new

feature-list_diffing-new

Additional fixes for List Diffing

06 Nov 15:28
Compare
Choose a tag to compare
Pre-release
Merge pull request #19 from caxy/feature-list_diffing-new

Feature list diffing new

Fix for List Diffing and setting a minimum match threshold percentage for list items

21 Oct 21:17
Compare
Choose a tag to compare
Merge pull request #17 from caxy/feature-list_diffing-new

Fix: Updated code so that null is not given in list formatting.

Fix issue in PHP versions < 5.5 (again)

20 Oct 21:51
Compare
Choose a tag to compare
Pre-release
Merge pull request #16 from caxy/feature-list_diffing-new

Missed an array_column in ListDiff. Updated to use ArrayColumn function.

Fix issue in PHP versions < 5.5

20 Oct 21:21
Compare
Choose a tag to compare
Pre-release
Merge pull request #15 from caxy/feature-list_diffing-new

Added update for php versions that do not have array_column as a function.

Add custom diffing logic for HTML Lists

20 Oct 20:35
Compare
Choose a tag to compare
Pre-release
Merge pull request #14 from caxy/feature-list_diffing-new

Created ListDiff class to handle diffing of lists.

Isolated Diffing of Special HTML Tags

11 Sep 00:14
Compare
Choose a tag to compare
Pre-release

Note: There are many changes to the HtmlDiff class in this release. A new AbstractDiff class was created and HtmlDiff extends this new class, and many of the common functions have been moved into the AbstractClass in preparation for some upcoming features and enhancements for the diffing of lists and tables.

Isolated Diffing of Special HTML Tags

Purpose

The purpose of these changes is to isolate certain HTML elements in the old and new texts and diff them against the matching element (if one exists), in order to prevent issues with matches in old and new text overlapping certain HTML elements.

The Problem

As an example, let's say you have the following inputs:

Old Text

Testing text with <sup>superscript</sup>

New Text

Testing text with superscript

Output Before These Changes

Testing some text with <ins class="mod">superscript</ins>

Output After These Changes

Testing some text with <sup class="diffmod"><del class="diffmod">superscript</del></sup><ins class="diffmod">superscript</ins>

As you can see in this example, before these changes were made it was seeing the match on the word superscript in both, but was not accounting for the fact that the word was in superscript in the old text and is no longer in superscript in the new text.

Solution

The solution that was implemented in this release was to encapsulate certain HTML elements and diff them separately from the rest of the text, in order to prevent issues with matches overlapping HTML elements.

Currently, the elements to isolate and diff are: ol, ul, dl, sup, sub, and table.

These are set on a protected property on the HtmlDiff class: $isolatedDiffTags. In this release, this property is not exposed to be configured, but there are additional updates coming soon that will allow configuration of the elements to be handled in this manner.

Variable and function visibility updates

03 Mar 14:41
Compare
Choose a tag to compare

Properties and functions in HtmlDiff.php have been updated to protected visibility instead of private to allow for extending the class.

Check for empty oldText or newText before processing del or ins in processReplaceOperation

09 Jan 00:57
Compare
Choose a tag to compare

Check for empty oldText or newText before processing del or ins in processReplaceOperation

Add option to insert a space between del and ins tags

08 Jan 23:21
Compare
Choose a tag to compare

Add option to insert a space between del and ins tags - this is only done in replacements, and will insert a space between the <del> and <ins> tags in the replace operation.