Repository navigation
Diff merge #71
Description
Activity
a pretty website...
@Announcement brainstorming new presentation is a very low priority for me. You can raise the priority of this issue by recommending a proposal, though.
Hi, I suggest the HTML 4 Strict to XHTML 1 Transitional (or another more appropriate) transformation including some single tags ended with and changing the !DOCTYPE line. You did an amazing job with this, and now I'm satisfied with my early confused Kompozer source-code. Thanks!
Priorities and roadblocks before work on v2 can start:
- New markup parser
- single unified parser for all markup related tasks
- parser will produce parallel arrays resembling the structures used in the jspretty and csspretty libraries
- cleaner and more modular code for both the parser and the beautifier
- Write a single CSV parser that conforms to the jspretty/csspretty parsing model.
- Build a test harness for automated unit tests of the node-local.js file (node api)
- test each options: defaults, accepted values, and rules/constraints
- test each output option against dummy code/dummy files
- test each supported mode against each output option
- Build a test harness for prettydiff code that can run based upon the node-local test harness
- unlike the node-local test harness this one will only be populated with simple foundational tests. This can be updated over time and hopefully with support from users.
The end result is to have a single uniform parsing model so that the diff library can operate against parsed tokens from a list instead of comparing beautified code. The goals:
- Allow potential for >2 way diff as a possible future enhanement
- Allow for greater precision in code analysis
- Allow for diff merge in a very language aware means
- Allow for superior automation potential both on the command line and in the browser
- New markup parser
Maintain HTML br like comments, so br's don't add to the indentation.
I would like to see better support for using prettydiff as a tool in automated tests. Basically, I need to test that some xslt produces the correct xml output. So I'm comparing the expected result with the computed output. I would like to be able to get back a simple "yes they are equal", or "no they are different (here are some line numbers)". With the current js api, the output is a DOM object, and I have to walk the DOM to extract this information. So it is currently possible, but very ugly and brittle.
Hello. You could add case-insensitivity option to diff.
@bobtherobot I will absolutely ensure that functionality is retained. I am almost ready to demo my new markup parser and I will let you know when it is ready.
@murrayju Have you tried using Pretty Diff with Node.js and using the diffcli? It produces output similar to git diff. If this still does not address your concerns please let me know and we can discuss how to make this better.
@Myp3ik Absolutely. I am almost ashamed I had not thought to add that before. I would likely only limit this to markup languages and string types in JavaScript.
@prettydiff I may be missing something, but I don't think that will do what I need. I'm running my tests in the browser (via Karma + Jasmine), so the node package won't work there. I'm also not comparing files so much as strings (generated by my code).
What I'm really asking for is a simple way to make my test pass or fail. A simple api like:
result = prettydiff({...}); // test assertion expect(result.differences).toBe(0);When there are differences (and my test fails), it would be helpful for debugging purposes if I could also output some simple text to the console, showing me where the problem is. I really do like the colored output of your diffcli, so it would be great if that could end up in my Karma log.
20 remaining items
For the PrettyDiff website, the ability to point at URLs directly in the interface without having to download and then upload source code. I recently had to compare changes in a situation where a repository had been extracted from a larger one, so being able to point at Github's raw textfiles would have been extremely handy.
@orbitbot That is a defect. Please try it now.
@prettydiff Err, how, exactly? I can't identify anywhere on the website to enter URLs...
Eg. if I would like to compare https://raw.githubusercontent.com/eclipse/paho.mqtt.java/e07b4191ecde8f6d638142d7bfee5f613d1ee841/org.eclipse.paho.android.service/org.eclipse.paho.android.service/src/main/java/org/eclipse/paho/android/service/MqttAndroidClient.java and https://raw.githubusercontent.com/eclipse/paho.mqtt.android/master/org.eclipse.paho.android.service/src/main/java/org/eclipse/paho/android/service/MqttAndroidClient.java , how would I do it?
@orbitbot Paste the URLs directly where you would paste in code. The tool will recognize the URL by looking for
httpat the start of the input.Be sure to compare those as plain text, because Java is not yet a supported language.
You could also do something like this:
Your link works, but I am not able to get it working with entering URLs and selecting plain text. To be clear, I entered both URLs before changing the language selection. Result:
Fundamentally, I would also say that this functionality exists in the first place is not obvious from the interface, which is why I posted the issue in the first place (came across this tool just a day or so ago).
@orbitbot I just tried it and it worked for me. I am thinking you might have old code cached in your browser. Try a hard refresh
- shift + F5 in Windows Chrome, Safari, or Opera
- ctrl + F5 in Windows Firefox
- shift + cmd + r in OSX
Also, try it as JavaScript. I was pleasantly surprised by the result. I cannot yet recommend JavaScript language processing for Java code, but in this case it works out perfectly.
@prettydiff Ok, that seems to work, I guess I had the previous code for the page in my cache.
Closing. A breaking change to the output format is coming. For more information please see #292
@prettydiff its a bit late to ask a question but i am using prettydiff in a browser using js/browser.js I got the difference using prettydiff() function but i wanna show it in a popup window as shown in your website. is it possible to do so by codes alone which are already in it?
@Trend74X you can control that in your own front-end just as the Pretty Diff web tool is a separate library from the core prettydiff code. So prettydiff() returns a string, so just redirect that string into some container such as innerHTML of a div.
Please let me know if that fails to answer your question.
@Trend74X you can control that in your own front-end just as the Pretty Diff web tool is a separate library from the core prettydiff code. So prettydiff() returns a string, so just redirect that string into some container such as innerHTML of a div.
Please let me know if that fails to answer your question.
Yes I am redirecting it to innerHTML right now, but its not what I wanted. I want to use popup as in your website using webtool. js is it possible?
Oh, I see. You can copy/paste code from my front-end library to use as your own. Look for these:
- method.event.grab - This is my drag and drop function. Executed from mousedown on the popup's heading element (title bar). If the popup is minimized this function calls the method.event.minimize function instead of performing drag and drop.
- method.event.maximize - This is the maximize function, executed from a button click in the UI.
- method.event.minimize - This is the minimize function, executed from a button click. If the popup is minimized this function will return the popup to its previous state.
- method.event.resize - This is the resize function that allows modifying the popup's dimensions. It is executed from a button click.
That is probably all you need, but feel free to browse through the prettydiff-webtool.ts file if there anything else you want to pick at. The file is pretty easy to read and well organized as modular components once you get past the initialization code and loading function at around line 2508.
I don't mean to be a stick in the mud, but next time please open questions as new issues. I appreciate all questions and interest in the project and am eager to help. In this case this thread contains lots of history, sends notifications to many users, and side conversations can be distracting.

I will add a merge capability to the tool. I am still thinking through how this will work while currently supporting the existing features. Any creative suggestions will be considered. A fantastic example of click to merge: http://kccode.googlecode.com/svn/trunk/source/diff/diff.html
Current thinking:
Unrelated: