From f106ad85ca1a5eaa20bfe00cc621f45d8d81692e Mon Sep 17 00:00:00 2001 From: Adam Waldenberg Date: Tue, 9 Apr 2013 21:17:21 +0200 Subject: [PATCH] Added HTML output to the timeline module. --- html/html.header | 14 ++++++++++++++ timeline.py | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/html/html.header b/html/html.header index d2bba87..32ad00b 100644 --- a/html/html.header +++ b/html/html.header @@ -45,6 +45,9 @@ font-size: small; width: 60%; }} + table.full {{ + width: 100%; + }} table.git th, table.git tfoot tr td {{ padding: 0.3em; background-color: #ddcece; @@ -57,6 +60,17 @@ }} table.git td {{ padding: 0.4em; + height: 1em; + }} + table.git td div.insert {{ + background-color: #7a7; + }} + table.git td div.remove {{ + background-color: #c66; + }} + table.git td div.insert, table.git td div.remove {{ + height: 100%; + float: left; }} table.git tr.odd {{ background-color: #dbdbdb; diff --git a/timeline.py b/timeline.py index 8906cd1..7566b84 100644 --- a/timeline.py +++ b/timeline.py @@ -123,6 +123,35 @@ def __output_row__text__(timeline_data, periods, names): print("") +def __output_row__html__(timeline_data, periods, names): + timeline_xml = "" + + for period in periods: + timeline_xml += "" + + timeline_xml += "" + + for i, name in enumerate(names): + timeline_xml += "" if i % 2 == 1 else ">") + timeline_xml += "" + for period in periods: + multiplier = timeline_data.get_multiplier(period, 14) + signs = timeline_data.get_author_signs_in_period(name, period, multiplier) + signs_str = (signs[1] * "
 
" + signs[0] * "
 
") + + timeline_xml += "" + timeline_xml += "" + + timeline_xml += "" + + for period in periods: + total_changes = timeline_data.get_total_changes_in_period(period) + timeline_xml += "" + + timeline_xml += "
Author" + str(period) + "
" + name + "" + ("." if timeline_data.is_author_in_period(period, name) and len(signs_str) == 0 else signs_str) + timeline_xml += "
Modified Rows:" + str(total_changes[2]) + "
" + print(timeline_xml) + class Timeline(Outputable): def __init__(self, changes, useweeks): self.changes = changes @@ -142,6 +171,23 @@ class Timeline(Outputable): for i in range(0, len(periods), max_periods_per_row): __output_row__text__(timeline_data, periods[i:i+max_periods_per_row], names) + def output_html(self): + if self.changes.get_commits(): + timeline_data = TimelineData(self.changes, self.useweeks) + periods = timeline_data.get_periods() + names = timeline_data.get_authors() + max_periods_per_row = 8 + + timeline_xml = "
" + timeline_xml += "

" + __timeline_info_text__ + ".

" + print(timeline_xml) + + for i in range(0, len(periods), max_periods_per_row): + __output_row__html__(timeline_data, periods[i:i+max_periods_per_row], names) + + timeline_xml = "
" + print(timeline_xml) + def output_xml(self): if self.changes.get_commits(): message_xml = "\t\t" + __timeline_info_text__ + "\n"