X-Git-Url: http://git.droids-corp.org/?p=diff2html.git;a=blobdiff_plain;f=diff2html.py;h=3e527000af39a89d9003b35e5579b4584b909d67;hp=d573d8fe8264e1abd59be97809bc89f9705ef0d9;hb=ea5aa9e8645cddd7aa8dce57e0506f5e2f1387ed;hpb=cae8dca768d5fc7aeb960322130fe95121000bb4
diff --git a/diff2html.py b/diff2html.py
index d573d8f..3e52700 100644
--- a/diff2html.py
+++ b/diff2html.py
@@ -33,7 +33,7 @@
# and display those directly.
-import sys, re, htmlentitydefs, getopt
+import sys, re, htmlentitydefs, getopt, StringIO
# minimum line size, we add a zero-sized breakable space every
# LINESIZE characters
@@ -106,7 +106,6 @@ def linediff(s, t):
m, n = len(s), len(t)
d = [[(0, 0) for i in range(n+1)] for i in range(m+1)]
- x = [[(0, 0) for i in range(n+1)] for i in range(m+1)]
d[0][0] = (0, (0, 0))
@@ -422,6 +421,13 @@ def main():
parse_input(input_file, output_file,
exclude_headers, show_hunk_infos)
+def parse_from_memory(txt, exclude_headers, show_hunk_infos):
+ " Parses diff from memory and returns a string with html "
+ input_stream = StringIO.StringIO(txt)
+ output_stream = StringIO.StringIO()
+ parse_input(input_stream, output_stream, exclude_headers, show_hunk_infos)
+ return output_stream.getvalue()
+
if __name__ == "__main__":
main()