@Role
public interface UnifiedDiffDisplayer
DiffResult
as a unified diff. The
unified diff consists in a sequence of blocks, each having elements marked as either added or removed, padded with
unmodified elements that put changes in context.Modifier and Type | Method and Description |
---|---|
<E,F> List<UnifiedDiffBlock<E,F>> |
display(DiffResult<E> diffResult)
Displays the given diff result as an unified diff using the default configuration.
|
<E,F> List<UnifiedDiffBlock<E,F>> |
display(DiffResult<E> diffResult,
UnifiedDiffConfiguration<E,F> config)
Displays the given diff result as an unified diff using the provided configuration.
|
<E,F> UnifiedDiffConfiguration<E,F> |
getDefaultConfiguration() |
<E,F> UnifiedDiffConfiguration<E,F> getDefaultConfiguration()
E
- the type of elements that are compared to produce the diffF
- the type of sub-elements that can be compared to produce an in-line diff when an element is modified<E,F> List<UnifiedDiffBlock<E,F>> display(DiffResult<E> diffResult)
E
- the type of elements that are compared to produce the diffF
- the type of sub-elements that can be compared to produce an in-line diff when an element is modifieddiffResult
- the diff resultdisplay(DiffResult, UnifiedDiffConfiguration)
<E,F> List<UnifiedDiffBlock<E,F>> display(DiffResult<E> diffResult, UnifiedDiffConfiguration<E,F> config)
2 * context size
, where context size represents the number of unmodified elements to
include before and after a change in order to place that change in context.
If the elements can be split in sub-elements, i.e. if a splitter is provided through the configuration, then the unified diff displays also the changes inside the modified elements.
If changes are computed at the line level in a text, i.e. the elements that are compared to produce the diff are lines of text, and a word splitter is provided through configuration then the following is a block from a unified diff:
@@ -81,5 +85,5 @@
first line of context
another unmodified line
-this line <del>has been removed</del>
+this line <ins>replaced the previous line</ins>
close the block with unmodified lines
last line of context
E
- the type of elements that were compared to produce the diffF
- the type of sub-elements that can be compared to produce an in-line diff when an element is modifieddiffResult
- the diff resultconfig
- the configurationCopyright © 2004–2014 XWiki. All rights reserved.