Git Product home page Git Product logo

scaladiff's Introduction

What is it?

A Scala library for performing diffs over plain text. Results can be produced in raw, cleaned (human readable), or html formats. The base diff algorithm used is Myer's diff algorithm.

Current Status

The API is mostly firmed up, and it does produce accurate diffs (to the degree that my unit tests have verified this), in raw, cleaned, and html formats. It does not yet produce unidiff output, though I do plan on making that a feature. I would advise using this for experimental work, and report all bugs to me so that I can get them fixed up and wrap some unit tests around them. I would like to get this stable and production ready as soon as possible, but I just don't feel comfortable with the level of testing just yet.

Installation

Add the following to your Build.scala file:

resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"

libraryDependencies ++= Seq(
    ... other dependencies ...
    "net.ironforged" % "scaladiff_2.10" % "0.1-SNAPSHOT"
)

Usage

Import net.ironforged.scaladiff.Diff and create a Diff instance with val diff = Diff.create(originalText, modifiedText). You can then access the diff text using one of three variations:

  • diff.toString is the raw diff (ex. bills +s+w-bo-ards)
  • diff.humanized is the more readable version of the diff (ex. bills -[boa]+[swo]rds)
  • diff.html is the html version of the humanized diff for display on a web page

Unidiff output will be added soon!

Roadmap

  • Add unidiff output
  • More tests
  • Stress tests (how large can the source/modified text get before we're crawling)
  • The ability to apply a diff as a patch to some text to produce the original version

LICENSE

Apache License 2.0

scaladiff's People

Contributors

bitwalker avatar josephpconley avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.