Interface DiffResource
-
Method Summary
Modifier and TypeMethodDescriptiondaisyDiff
(DaisyDiffRequest request) Annotates a newer HTML document with differences to an older HTML document.diffHTML
(DiffRequest request) Method to calculate the diff in HTMLdiffSource
(DiffRequest request) Method to calculate the diff between two HTML contents in source
-
Method Details
-
daisyDiff
Annotates a newer HTML document with differences to an older HTML document.The annotations will be done by the DaisyDiff Algorithm. Please see the DaisyDiff project site for more information and examples.
The resulting HTML will need some CSS and (optionally) some Javascript includes from version 1.1 of the DaisyDiff distribution.
The CSS file in "css/diff.css" of the DaisyDiff distribution archive provides basic styles for inserted/deleted/changed elements and is sufficient by itself to provide basic visualization of changes.
The following JavaScript files need to be included to get an extended interface that allows navigation between changes and provides more information about a change when it is clicked:
- lib/js/daisydiff-1.1/tooltip/wz_tooltip.js
- lib/js/daisydiff-1.1/tooltip/tip_balloon.js
- lib/js/daisydiff-1.1/dojo/dojo.js
- lib/js/daisydiff-1.1/diff.js
The included JavaScript must be explicitly initialized: <script type='text/javascript'>htmlDiffInit();</script>
The DaisyDiff algorithm differs from the standard diff algorithm in that it tries to preserve the HTML tree structure, while the standard HTML diff alogrithm may break it.
If the given HTML documents contain <body> tags, only content inside the tags will be diffed. Differences outside the body tags will be ignored. The resulting HTML document will contain the same header (substring from start of document until and including the body tag) as the newer document.
Please note that the HTML diff will not reflect the changes exactly. The HTML will be cleaned up and some content may be lost in this process. The result is meant for human consumption, not to generate exact differences between HTML documents.
- Parameters:
request
- contains the parameters for the DaisyDiff algorithm- Returns:
- a response containing the diff for the two HTML documents
-
diffHTML
Method to calculate the diff in HTML- Parameters:
request
- request containing the HTML contents to be diffed- Returns:
- response containing the diff
-
diffSource
Method to calculate the diff between two HTML contents in source- Parameters:
request
- request containing the HTML contents to be diffed- Returns:
- response containing the diff
-