GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — DiffRowGenerator should be able to deliver DiffRow list wwithout HTML tags in oldLine and newLine · Issue #11 · java-diff-utils/java-diff-utils

DiffRowGenerator should be able to deliver DiffRow list wwithout HTML tags in oldLine and newLine #11

New issue
Copy link
New issue
Copy link
Closed
Closed
DiffRowGenerator should be able to deliver DiffRow list wwithout HTML tags in oldLine and newLine#11
Copy link

Description

@ADiex
ADiex
opened on Aug 17, 2017
Issue body actions

By default DiffRowGenerator.generateDiffRows delivers a List of DiffRow where the oldLine and the newLine property are polluted with HTML tags like
and HTML-escaping sequences like &gt.

It should be possible to get the unmodified text lines back for use in projects where HTML enrichment/escaping is not necessary or useful.

My proposal is to introduce a new property reportLinesUnWrapped which can be set by the DiffRowGenerator.Builder. If this property is set to true the DiffRowGenerator delivers back the original text lines.

Please see the attached source.
DiffRowGenerator.zip

Activity

  1. wumpz commented on Aug 17, 2017

    @wumpz
    wumpz
    on Aug 17, 2017
    Collaborator
    More actions

    The tags included can be modified using the builder.

  2. wumpz commented on Aug 17, 2017

    @wumpz
    wumpz
    on Aug 17, 2017
    Collaborator
    More actions

    If you look at the examples for markup presentation you will see.

  3. wumpz commented on Aug 18, 2017

    @wumpz
    wumpz
    on Aug 18, 2017
    Collaborator
    More actions

    The DiffRowGenerator is exactly for this purpose. If you only want to get a changeset you should got for DiffUtils. Look at the first example (ComputeDifference.java).

  4. ADiex commented on Aug 18, 2017

    @ADiex
    ADiex
    on Aug 18, 2017
    Author
    More actions

    The only way to achieve approximatle what diffRowGenerator.generateDiffRows does is DiffUtils.diff (List original, List revised). But my tests with this method and also your example have shown that it only provides the deltas change, insert, delete, and not the unchanged lines. And it also does not provide the the very good line-wise depiction of original and revised as pointed out in DiffRowGenerator. The initial author of DiffRowGenerator unfortunately mixed HTML presentation issues into the generation of a DiffRow list. The DiffRowGenerator could cover not only the requirement to generate HTML-capable code, but also the output of the pure differences of texts. The few lines of code that I inserted in my suggestion there would reach that goal.
    Unittest.zip

  5. wumpz commented on Aug 18, 2017

    @wumpz
    wumpz
    on Aug 18, 2017
    Collaborator
    More actions

    Ah. Sorry. I missed your point. Sure your flag does make thing easier. At the moment you could simulate it using:

    DiffRowGenerator generator = DiffRowGenerator.create()
                    .columnWidth(Integer.MAX_VALUE)
                    .oldTag(f -> "")
                    .newTag(f -> "")
                    .build();
    

    I will integrate your change request, but the method name will be reportLinesUnchanged since you are more than wrap skipping.

  6. wumpz
    closed this as completedin 1107f43on Aug 18, 2017
  7. wumpz
    added a commit that references this issue on Aug 18, 2017

    fixes #11

    This issue will close once commit 5d5218b is merged into the 'master' branch.
    5d5218b
  8. rosta commented on Jul 27, 2019

    @rosta
    rosta
    on Jul 27, 2019
    Contributor
    More actions

    There is a use case where the raw value would be useful as well as the formatted value:

    I need to filter out certain differences by matching them against a set of regular expressions. These expressions are much easier to specify for the raw text than for the html/markdown formatted text. As such it would be nice to have the possibility to hold the raw texts in the DiffRow

  9. wumpz commented on Jul 27, 2019

    @wumpz
    wumpz
    on Jul 27, 2019
    Collaborator
    More actions

    @rosta Could you make a separate issue with an example. I M not sure if I understand your problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.