DiffRowGenerator replaces < and > #41
Copy link
Copy link
Closed
Description
Expected Behavior
DiffRowGenerator would leave < and > the way they are
Actual Behavior
DiffRowGenerator replaces < and > with their html entities.
Steps to Reproduce the Problem
- Run
DiffRowGenerator.create().generateDiffRows(List.of("<"), List.of("<")) - Observe that the resulting String has < instead of <
Specifications
- Version: 4.0
- Platform: Linux
- Subsystem:
Using reportLinesUnchanged is not an option since that means tags are missing if an entire line is added/deleted. Having something like replaceSomeHTMLEntities with default true but optionally disableable would be nice, or being able to supply a general string normalisation function.
If needed/wanted I can PR this.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
wumpz commentedon May 7, 2019
I see. Let me think about a proper solution. Maybe it is time to provide a normalization hook into java-diff-utils. There the HTML entities are replaced in addition to tabs.
wumpz commentedon May 7, 2019
I introduced the possibility to modify the used line normalizer. This should provide you with a tool to achieve what you want.
Look at:
java-diff-utils/src/test/java/com/github/difflib/text/DiffRowGeneratorTest.java
Line 401 in a8d968c
codebusta commentedon Sep 19, 2019
Why this is not available in the maven repo, I'm using the following dependency:
<dependency> <groupId>io.github.java-diff-utils</groupId> <artifactId>java-diff-utils</artifactId> <version>4.0</version> </dependency>wumpz commentedon Sep 19, 2019
Don't know. I will look into it.
wumpz commentedon Sep 20, 2019
The issue was closed after release 4.0 was created. You have to use 4.1-SNAPSHOT. The release is delayed due to the problematic new unified diff parser and writer. I don't want to put it into a release.
codebusta commentedon Sep 20, 2019
Why this 4.1-SNAPSHOT is not available in maven repo to include in my project. What can you suggest?
wumpz commentedon Sep 21, 2019
Hmm. Maybe I never deployed it?
wumpz commentedon Sep 21, 2019
4.1-SNAPSHOT is deployed.
wumpz commentedon Sep 21, 2019
Snapshots are deployed at sonatype.
codebusta commentedon Sep 24, 2019
How I can include this snapshot in my pom.xml?
codebusta commentedon Sep 24, 2019
Ok, found it, jfyi, include the following in your pom.xml: