Display a Diff as a Webpage using diff2html
Sometimes, especially for documentation purposes, it might be necessary to show a unified diff as a HTML page.
As we will ditch Basic theme in OXID eShop version 4.7/5.0, we had to document how to convert a customized theme based on Basic if you want to update. Included, we wanted to deliver a visual diff of the categorylist.tpl file to show how the category tree was loaded before and how it will be loaded from the new version on.
I found out that neither my IDE nor any other diff tools I knew could export directly to HTML. After a while of searching I found this great bash script: diff2html
Unpack it and you will find just one single file. On Linux, it is pretty easy to use:
~$ ./diff2html file1.txt file2.txt > differences.html
There are several options as well as an own style sheet that can be used (open this file and have a look at it). But even the default results are looking absolutely suitable.
Habe mal ein PHP Script geschrieben was alle tpl Dateien “diffed” und dann html Files generiert. Ich überlege ob das als Modul Sinn macht ?
Guss Frank
Depends what shall be diff’ed. Actually tpl diffs are already provided as HTML in cumulative update packages, generated by deployer during the release process. Unfortunately, it cannot be used as a stand alone tool for other purposes.
I like this solution and wanted to use it but when I use it. It gives me error like:
./diff2html: line 133: return: -1: invalid option
return: usage: return [n]
./diff2html: line 163: return: -1: invalid option
return: usage: return [n]
./diff2html: line 102: return: -1: invalid option
return: usage: return [n]
./diff2html: line 133: return: -1: invalid option
return: usage: return [n]
./diff2html: line 163: return: -1: invalid option
return: usage: return [n]
./diff2html: line 102: return: -1: invalid option
return: usage: return [n]
./diff2html: line 133: return: -1: invalid option
return: usage: return [n]
./diff2html: line 163: return: -1: invalid option
return: usage: return [n]
./diff2html: line 102: return: -1: invalid option
return: usage: return [n]
When I look at the redirected output. It does not show any highlights of differences. What am I doing wrong?
I use this syntax while submitting report. Diff2html aa bb > cc.html
Don’t know what Linux version you use but still works perfect for me with Linux Mint 18 Sarah.
Its working perfect except highlighting the differences , please let me know if we need to provide any specific option /stylesheet for highlighting the diffs.