Plugin to allow visitor contributions to WordPress posts, wiki style.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

116 lines
4.5 KiB

  1. Differences from rashid2538/php-htmldiff
  2. ========================================
  3. .. contents:: Table of Contents
  4. Code Styling and Clean-up
  5. -------------------------
  6. * Added namespaces, split up classes to their own files, some code styling changes
  7. Enhancements
  8. ------------
  9. * Allow the specialCaseOpeningTags and specialCaseClosingTags properties to be modified by passing an array into the constructor or using set/add/remove functions
  10. * Updated the demo to accept input and diff via AJAX
  11. * Added static properties for the default config variables
  12. Bug Fixes
  13. ---------
  14. * Fixed an index out of range bug (may have been fixed on the original repo since): c9ba1fa_
  15. * Check for empty oldText or newText before processing del or ins in processReplaceOperation function
  16. New Features
  17. ------------
  18. Isolated Diffing of certain HTML elements
  19. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  20. This is the one of the largest changes from the original repository.
  21. For more information, see the release notes for tag `0.0.6`_
  22. List Diffing
  23. ^^^^^^^^^^^^
  24. Similar to the Isolated Diffing feature, but specifically for HTML lists.
  25. More information is to come on this, and there will definitely be some tweaks and configuration options added for this
  26. feature. Currently there is no easy way to enable/disable the feature, so if you're having issues with it I suggest
  27. using the `0.0.6`_ or earlier release.
  28. Table Diffing
  29. ^^^^^^^^^^^^^
  30. Similar to the Isolated Diffing and List Diffing features, but specifically for HTML tables.
  31. More information to come on this soon.
  32. New option to group together diffed words by not matching on whitespace-only. Option is enabled by default.
  33. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  34. This was a specific requirement for an application we use this library for. The original library would replace
  35. single words at a time, but enabling this feature will group replacements instead. See example below.
  36. Old Text::
  37. testing some text here and there
  38. New Text::
  39. testing other words here and there
  40. With $groupDiffs = false (original functionality)::
  41. testing <del>some</del><ins>other</ins> <del>text</del><ins>words</ins> here and there
  42. With $groupDiffs = true (new feature)::
  43. testing <del>some text</del><ins>other words</ins> here and there
  44. Change diffing to strike through entire words/numbers if they contain periods or commas within the word
  45. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  46. This change introduced a new property ``$specialCaseChars``, which defaults to the following characters: ``.`` ``,`` ``(`` ``)`` ``'``
  47. This feature can be "disabled" by simply setting the $specialCaseChars to an empty array i.e. ``$diff->setSpecialCaseChars(array())``
  48. In the original library, special characters are treated as their own "words" even if they are in the middle of a word.
  49. This causes weird things to happen when diffing numbers that have a comma or a period in the middle of the number.
  50. For example, diffing ``10,000.50`` against ``11,100.75`` gives you:
  51. Original Functionality::
  52. <del class="diffmod">10</del><ins class="diffmod">11</ins>,<del class="diffmod">000</del><ins class="diffmod">100</ins>.<del class="diffmod">50</del><ins class="diffmod">75</ins>
  53. This is very difficult to read, so the new feature allows you to add ``.`` and ``,`` to the ``$specialCaseChars`` array in order
  54. to get output that looks like::
  55. <del class="diffmod">10,000.50</del><ins class="diffmod">11,100.75</ins>
  56. Note: It will *not* treat the specialCaseChars as part of the word if it is at the beginning or end of the word,
  57. so normal periods or commas at the end of words will still be diffed like the original.
  58. Added option to insert a space between ``<del>`` and ``<ins>`` tags. Disabled by default.
  59. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  60. This was a requirement for one our applications that uses this library.
  61. New property ``$insertSpaceInReplace`` was added, and setting it to true will simply add a space between
  62. the ``<del>`` and ``<ins>`` tags in replace operations, which was requested for easier reading.
  63. Enable it by calling ``$diff->setInsertSpaceInReplace(true);``
  64. Original Functionality::
  65. <del>Old</del><ins>New</ins>
  66. New Functionality::
  67. <del>Old</del> <ins>New</ins>
  68. .. _c9ba1fa: https://github.com/caxy/php-htmldiff/commit/c9ba1fab6777cd47427477f8d747293bb01ef1e8
  69. .. _0.0.6: https://github.com/caxy/php-htmldiff/releases/tag/0.0.6