Changes for page Diff Module

Last modified by Michael Hamann on 2023/07/26 16:06

<
From version < 11.1 >
edited by Simon Urli
on 2019/08/12 09:50
To version < 13.1 >
edited by Marius Dumitru Florea
on 2019/12/11 15:55
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -xwiki:XWiki.surli
1 +xwiki:XWiki.mflorea
ExtensionCode.ExtensionClass[0]
Description
... ... @@ -121,6 +121,11 @@
121 121  #end
122 122  {{/code}}
123 123  
124 +== Conflicts Display ==
125 +
126 +Starting with {{code}}XWiki 11.7RC1{{/code}} the display diff API also allows to display information about conflicts.
127 +The APIs to build unified diff takes as input a list of conflict elements that have been computed during a merge: some conflict information are then available in the resulting unified diff blocks, and can be used to present conflicts and possible decisions inside an UI presenting unified diff.
128 +
124 124  = XML Diff =
125 125  
126 126  This module provides an API to compute and display the changes between 2 XML trees (DOM instances). It was introduced in XWiki 11.6RC1.
... ... @@ -176,23 +176,27 @@
176 176  
177 177  == Displaying the Changes ==
178 178  
179 -To display the changes you need to use the ##XMLDiffMarker## and ##XMLDiffPruner## components like this:
184 +To compute and display the changes you can use the ##XMLDiffManager## component.
180 180  
181 181  {{code language="java"}}
182 -// Compute the changes and mark them in the previous document (e.g. using special attributes and elements).
183 -if (xmlDiffMarker.markDiff(previousDocument, nextDocument)) {
184 - // Hide nodes that have not changed.
185 - xmlDiffPruner.prune(previousDocument);
186 - // Serialize previous document.
187 - ...
188 -} else {
189 - // No changes detected.
187 +public interface XMLDiffManager
188 +{
189 + /**
190 + * Computes and marks the differences between two XML documents.
191 + *
192 + * @param left the left side of the comparison
193 + * @param right the right side of the comparison
194 + * @param config the configuration
195 + * @return the differences between the two XML documents
196 + * @throws DiffException if the difference can't be computed
197 + */
198 + String diff(String left, String right, XMLDiffConfiguration config) throws DiffException;
190 190  }
191 191  {{/code}}
192 192  
193 193  === HTML Visual Diff ===
194 194  
195 -Both ##XMLDiffMarker## and ##XMLDiffPruner## have implementations dedicated to computing a visual diff on HTML. Best is to use the provided script service:
204 +The ##XMLDiffManager## has an implementation dedicated to computing a visual diff on HTML. Best is to use the provided script service:
196 196  
197 197  {{code language="none"}}
198 198  <div class="html-diff">

Get Connected