diff to html (diff2html) program [closed]

℡╲_俬逩灬. 提交于 2019-11-27 00:03:04

问题


I'm looking for a "diff to html" program, which would generate a static html page from a given diff/patch file.

I've googled for it of course, but apart from some scripts I've found there's no "real project" (e.g. no package in Debian/Ubuntu).

Have I missed something? Can you recommend anything?


回答1:


You can use diff2html.py that is able to create a side-by-side diff in a static html page, from an unified diff input. The script is written in python.

cat foo.diff | python diff2html.py > foo.html



回答2:


pygments has syntax highlighting for diff (and for lots of other languages), and can be used as a library or a command-line program. Is that the sort of thing you're looking for? If not please clarify the question...




回答3:


Something along the lines of:

vim test.diff -c TOhtml -c ":saveas test.html" -c ":q" -c ":q"

works well, and you can change the color-scheme of the diff by changing the color scheme in vi.




回答4:


how about Text-Diff-HTML, difflib.HtmlDiff, CSDiff?




回答5:


http://www.sourceforge.net/projects/diff2html




回答6:


Have you tried http://prettydiff.com/ as it ignores differences in white space and comments.

[Disclaimer: this is my site]




回答7:


There's also 2html in Vim, which works very well, and it's built-in: it takes a file that Vim knows how to highlight its syntax, and creates an HTML with the correct formatting. To use it, just open the wanted file with Vim, and source the 2html script. It will open the converted file in a new buffer, which can be saved. Here:

vim example.diff

and then in Vim,

:so /usr/share/vim/vim72/syntax/2html.vim
:wqa



回答8:


I use htmlize in Emacs. Doesn't come with Emacs, and assumes you're using Emacs. Relies on the syntax highlighting of Emacs's Diff mode. Only good for doing one file at a time. Does the right thing for me.




回答9:


The best I've found that produces nice side-by-side diffs is this script:

http://tools.ietf.org/tools/rfcdiff/

Although it's designed to be used on RFCs it works with any text file.

This project also has nice output, but I'm not sure if it can be used without subversion: http://code.google.com/p/coderev/




回答10:


I found coderev, demo looks nice



来源:https://stackoverflow.com/questions/641055/diff-to-html-diff2html-program

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!