Skip to content

DiffRowGenerator replaces < and > #41

Closed

Description

@JoJoDeveloping

Expected Behavior

DiffRowGenerator would leave < and > the way they are

Actual Behavior

DiffRowGenerator replaces < and > with their html entities.

Steps to Reproduce the Problem

  1. Run DiffRowGenerator.create().generateDiffRows(List.of("<"), List.of("<"))
  2. Observe that the resulting String has &lt; 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.

Activity

  1. wumpz commented on May 7, 2019

    @wumpz
    Collaborator

    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.

  2. self-assigned this
    on May 7, 2019
  3. wumpz commented on May 7, 2019

    @wumpz
    Collaborator

    I introduced the possibility to modify the used line normalizer. This should provide you with a tool to achieve what you want.

    Look at:

    .lineNormalizer(str -> str.replace("\t", " "))

  4. codebusta commented on Sep 19, 2019

    @codebusta

    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>

  5. wumpz commented on Sep 19, 2019

    @wumpz
    Collaborator

    Don't know. I will look into it.

  6. reopened this on Sep 19, 2019
  7. wumpz commented on Sep 20, 2019

    @wumpz
    Collaborator

    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.

  8. codebusta commented on Sep 20, 2019

    @codebusta

    Why this 4.1-SNAPSHOT is not available in maven repo to include in my project. What can you suggest?

  9. wumpz commented on Sep 21, 2019

    @wumpz
    Collaborator

    Hmm. Maybe I never deployed it?

  10. wumpz commented on Sep 21, 2019

    @wumpz
    Collaborator

    4.1-SNAPSHOT is deployed.

  11. wumpz commented on Sep 21, 2019

    @wumpz
    Collaborator

    Snapshots are deployed at sonatype.

  12. codebusta commented on Sep 24, 2019

    @codebusta

    How I can include this snapshot in my pom.xml?

  13. codebusta commented on Sep 24, 2019

    @codebusta

    Ok, found it, jfyi, include the following in your pom.xml:

     <profiles>
        <profile>
            <id>allow-snapshots</id>
            <activation><activeByDefault>true</activeByDefault></activation>
            <repositories>
                <repository>
                    <id>snapshots-repo</id>
                    <url>https://oss.sonatype.org/content/repositories/snapshots</url>
                    <releases><enabled>false</enabled></releases>
                    <snapshots><enabled>true</enabled></snapshots>
                </repository>
            </repositories>
        </profile>
    </profiles>
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions