From f4c8aa05b548e1ba06795f4f6de37fd4eda765ed Mon Sep 17 00:00:00 2001 From: Adam Waldenberg Date: Sat, 17 Nov 2012 00:35:56 +0100 Subject: [PATCH] Created an initial version of the HTML in the blame module. Currently, the output is very rough and needs a lot of work. However, the integration with flot and all data output seems to be correct. --- blame.py | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/blame.py b/blame.py index 140863d..23231fe 100644 --- a/blame.py +++ b/blame.py @@ -147,7 +147,45 @@ __blame_info_text__ = ("Below are the number of rows from each author that have "intact in the current revision") def output_html(hard): - print("HTML output not yet supported.") + get(hard) + + message_xml = "

" + __blame_info_text__ + ".

\n" + blame_xml = "
" + blame_xml += "" + blame_xml += "" + chart_data = "" + blames = sorted(__blame__.get_summed_blames().items()) + total_blames = 0 + + for i in blames: + total_blames += i[1].rows + + for i, entry in enumerate(blames): + blame_xml += "" if i % 2 == 1 else ">") + blame_xml += "" + blame_xml += "" + blame_xml += "" + blame_xml += "" + chart_data += "{{label: \"{0}\", data: {1}}}".format(entry[0], "{0:.2f}".format(100.0 * entry[1].rows / total_blames)) + + if blames[-1] != entry: + chart_data += ", " + + blame_xml += "
Author Rows % in comments
" + entry[0] + "" + str(entry[1].rows) + "" + "{0:.2f}".format(100.0 * entry[1].comments / entry[1].rows) + "
     
" + blame_xml += "
" + + blame_xml += "" + + print(message_xml + blame_xml) def output_text(hard): print("")