X-Git-Url: http://git.droids-corp.org/?p=diff2html.git;a=blobdiff_plain;f=diff2html.py;h=1b95cf56f6d980f2e5fe5b40614e05cc2ab5dc9e;hp=321632ec274234f1c4f3bdadc914ac8ace1be79a;hb=d05f862c931ab68b43c85f4e4ebdf36d6f52cfc2;hpb=86b0fd9f28780eb0d2e52cc5097a7768bb1561d2
diff --git a/diff2html.py b/diff2html.py
index 321632e..1b95cf5 100644
--- a/diff2html.py
+++ b/diff2html.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#! /usr/bin/python
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -18,15 +18,34 @@
# Transform a unified diff from stdin to a colored
# side-by-side HTML page on stdout.
#
-# Author: Olivier MATZ
+# Authors: Olivier MATZ
+# Alan De Smet
#
# Inspired by diff2html.rb from Dave Burt
# (mainly for html theme)
+#
+# TODO:
+# - The sane function currently mashes non-ASCII characters to "."
+# Instead be clever and convert to something like "xF0"
+# (the hex value), and mark with a . Even more clever:
+# Detect if the character is "printable" for whatever definition,
+# and display those directly.
+
+import sys, re, htmlentitydefs, getopt
+
+# minimum line size, we add a zero-sized breakable space every
+# LINESIZE characters
+linesize = 20
+tabsize = 8
+input_file = sys.stdin
+output_file = sys.stdout
+exclude_headers = False
+show_CR = False
+show_hunk_infos = False
-import sys, re, htmlentitydefs
-html_hdr="""
+html_hdr = """
HTML Diff
@@ -34,64 +53,70 @@ html_hdr="""
table { border:0px; border-collapse:collapse; width: 100%; font-size:0.75em; font-family: Lucida Console, monospace }
td.line { color:#8080a0 }
th { background: black; color: white }
- tr.unmodified td { background: #D0D0E0 }
- tr.hunk td { background: #A0A0A0 }
- tr.added td { background: #CCFFCC }
- tr.deleted td { background: #FFCCCC }
- tr.changed td { background: #FFFFA0 }
- span.changed2 { background: #E0C880 }
- span.ponct { color: #B08080 }
- tr.misc td {}
- tr.separator td {}
+ tr.diffunmodified td { background: #D0D0E0 }
+ tr.diffhunk td { background: #A0A0A0 }
+ tr.diffadded td { background: #CCFFCC }
+ tr.diffdeleted td { background: #FFCCCC }
+ tr.diffchanged td { background: #FFFFA0 }
+ span.diffchanged2 { background: #E0C880 }
+ span.diffponct { color: #B08080 }
+ tr.diffmisc td {}
+ tr.diffseparator td {}
-
+html_footer = """
+