org.xwiki.diff.display
Interface InlineDiffDisplayer
@Role
public interface InlineDiffDisplayer
Displays a DiffResult
as an in-line diff. An in-line diff is made of a list of chunks, each marked as added,
removed or unmodified. For instance, if changes are computed at word level then you could have this in-line diff:
the <del>quick</del><ins>sick</ins> brown fox
At character level the diff looks a bit different:
the <del>qu</del><ins>s</ins>ick brown fox
In this case the first chunk is "the ", an unmodified chunk, made of 4 characters and the second chunk is "qu", a
removed chunk, made of 2 characters. An in-line diff can be displayed either as you've seen above, mixing added and
removed chunks in one line, or it can be displayed on two lines, one showing the removed chunks and the other the
added chunks:
the <del>quick</del> brown fox
the <ins>sick</ins> brown fox
- Since:
- 4.1RC1
- Version:
- $Id: 50d1b72f19cff847e4d6cc854620186184731a83 $
Method Summary |
|
display(DiffResult<E> diffResult)
Displays the given diff result as an in-line diff. |
display
<E> List<InlineDiffChunk<E>> display(DiffResult<E> diffResult)
- Displays the given diff result as an in-line diff. An in-line diff is a list of group of elements, each group
being marked as added, removed or unmodified. The in-line diff includes all the elements from the previous and
the next version that were compared to produce the diff:
- the elements found in the previous version but not in the next version are marked at removed
- the elements from the next version that are not present in the previous version are marked as added
- the rest of the elements that are found in both versions are marked as unmodified.
If changes are computed at character level, i.e. the type of elements that are compared is Character
,
then the in-line diff between "the quick fox" and "the sick fox" is:
the <del>qu</del><ins>s</ins>ick fox
and is made of 4 groups of Character
s: "the " unmodified, "qu" removed, "s" added and "ick fox"
unmodified.
- Type Parameters:
E
- the type of elements that are add/remove/modified in the given diff result (specifies the granularity
level of changes)- Parameters:
diffResult
- the diff result to be displayed
- Returns:
- the list of chunks that form the in-line diff
Copyright © 2004-2013 XWiki. All Rights Reserved.