浏览代码

Generate html5, not xhtml.

Heikki Hokkanen 11 年前
父节点
当前提交
107ada370a
共有 1 个文件被更改,包括 15 次插入16 次删除
  1. 15
    16
      gitstats

+ 15
- 16
gitstats 查看文件

839
 			else:
839
 			else:
840
 				f.write('<td>0.00</td>')
840
 				f.write('<td>0.00</td>')
841
 		f.write('</tr></table>')
841
 		f.write('</tr></table>')
842
-		f.write('<img src="hour_of_day.png" alt="Hour of Day" />')
842
+		f.write('<img src="hour_of_day.png" alt="Hour of Day">')
843
 		fg = open(path + '/hour_of_day.dat', 'w')
843
 		fg = open(path + '/hour_of_day.dat', 'w')
844
 		for i in range(0, 24):
844
 		for i in range(0, 24):
845
 			if i in hour_of_day:
845
 			if i in hour_of_day:
867
 				f.write('<td>0</td>')
867
 				f.write('<td>0</td>')
868
 			f.write('</tr>')
868
 			f.write('</tr>')
869
 		f.write('</table></div>')
869
 		f.write('</table></div>')
870
-		f.write('<img src="day_of_week.png" alt="Day of Week" />')
870
+		f.write('<img src="day_of_week.png" alt="Day of Week">')
871
 		fp.close()
871
 		fp.close()
872
 
872
 
873
 		# Hour of Week
873
 		# Hour of Week
910
 			fp.write('%d %d\n' % (mm, commits))
910
 			fp.write('%d %d\n' % (mm, commits))
911
 		fp.close()
911
 		fp.close()
912
 		f.write('</table></div>')
912
 		f.write('</table></div>')
913
-		f.write('<img src="month_of_year.png" alt="Month of Year" />')
913
+		f.write('<img src="month_of_year.png" alt="Month of Year">')
914
 
914
 
915
 		# Commits by year/month
915
 		# Commits by year/month
916
 		f.write(html_header(2, 'Commits by year/month'))
916
 		f.write(html_header(2, 'Commits by year/month'))
918
 		for yymm in reversed(sorted(data.commits_by_month.keys())):
918
 		for yymm in reversed(sorted(data.commits_by_month.keys())):
919
 			f.write('<tr><td>%s</td><td>%d</td><td>%d</td><td>%d</td></tr>' % (yymm, data.commits_by_month.get(yymm,0), data.lines_added_by_month.get(yymm,0), data.lines_removed_by_month.get(yymm,0)))
919
 			f.write('<tr><td>%s</td><td>%d</td><td>%d</td><td>%d</td></tr>' % (yymm, data.commits_by_month.get(yymm,0), data.lines_added_by_month.get(yymm,0), data.lines_removed_by_month.get(yymm,0)))
920
 		f.write('</table></div>')
920
 		f.write('</table></div>')
921
-		f.write('<img src="commits_by_year_month.png" alt="Commits by year/month" />')
921
+		f.write('<img src="commits_by_year_month.png" alt="Commits by year/month">')
922
 		fg = open(path + '/commits_by_year_month.dat', 'w')
922
 		fg = open(path + '/commits_by_year_month.dat', 'w')
923
 		for yymm in sorted(data.commits_by_month.keys()):
923
 		for yymm in sorted(data.commits_by_month.keys()):
924
 			fg.write('%s %s\n' % (yymm, data.commits_by_month[yymm]))
924
 			fg.write('%s %s\n' % (yymm, data.commits_by_month[yymm]))
930
 		for yy in reversed(sorted(data.commits_by_year.keys())):
930
 		for yy in reversed(sorted(data.commits_by_year.keys())):
931
 			f.write('<tr><td>%s</td><td>%d (%.2f%%)</td><td>%d</td><td>%d</td></tr>' % (yy, data.commits_by_year.get(yy,0), (100.0 * data.commits_by_year.get(yy,0)) / data.getTotalCommits(), data.lines_added_by_year.get(yy,0), data.lines_removed_by_year.get(yy,0)))
931
 			f.write('<tr><td>%s</td><td>%d (%.2f%%)</td><td>%d</td><td>%d</td></tr>' % (yy, data.commits_by_year.get(yy,0), (100.0 * data.commits_by_year.get(yy,0)) / data.getTotalCommits(), data.lines_added_by_year.get(yy,0), data.lines_removed_by_year.get(yy,0)))
932
 		f.write('</table></div>')
932
 		f.write('</table></div>')
933
-		f.write('<img src="commits_by_year.png" alt="Commits by Year" />')
933
+		f.write('<img src="commits_by_year.png" alt="Commits by Year">')
934
 		fg = open(path + '/commits_by_year.dat', 'w')
934
 		fg = open(path + '/commits_by_year.dat', 'w')
935
 		for yy in sorted(data.commits_by_year.keys()):
935
 		for yy in sorted(data.commits_by_year.keys()):
936
 			fg.write('%d %d\n' % (yy, data.commits_by_year[yy]))
936
 			fg.write('%d %d\n' % (yy, data.commits_by_year[yy]))
974
 			f.write('<p class="moreauthors">These didn\'t make it to the top: %s</p>' % ', '.join(rest))
974
 			f.write('<p class="moreauthors">These didn\'t make it to the top: %s</p>' % ', '.join(rest))
975
 
975
 
976
 		f.write(html_header(2, 'Cumulated Added Lines of Code per Author'))
976
 		f.write(html_header(2, 'Cumulated Added Lines of Code per Author'))
977
-		f.write('<img src="lines_of_code_by_author.png" alt="Lines of code per Author" />')
977
+		f.write('<img src="lines_of_code_by_author.png" alt="Lines of code per Author">')
978
 		if len(allauthors) > conf['max_authors']:
978
 		if len(allauthors) > conf['max_authors']:
979
 			f.write('<p class="moreauthors">Only top %d authors shown</p>' % conf['max_authors'])
979
 			f.write('<p class="moreauthors">Only top %d authors shown</p>' % conf['max_authors'])
980
 
980
 
981
 		f.write(html_header(2, 'Commits per Author'))
981
 		f.write(html_header(2, 'Commits per Author'))
982
-		f.write('<img src="commits_by_author.png" alt="Commits per Author" />')
982
+		f.write('<img src="commits_by_author.png" alt="Commits per Author">')
983
 		if len(allauthors) > conf['max_authors']:
983
 		if len(allauthors) > conf['max_authors']:
984
 			f.write('<p class="moreauthors">Only top %d authors shown</p>' % conf['max_authors'])
984
 			f.write('<p class="moreauthors">Only top %d authors shown</p>' % conf['max_authors'])
985
 
985
 
1057
 			fp.write('%s %d %d\n' % (domain, n , info['commits']))
1057
 			fp.write('%s %d %d\n' % (domain, n , info['commits']))
1058
 			f.write('<tr><th>%s</th><td>%d (%.2f%%)</td></tr>' % (domain, info['commits'], (100.0 * info['commits'] / totalcommits)))
1058
 			f.write('<tr><th>%s</th><td>%d (%.2f%%)</td></tr>' % (domain, info['commits'], (100.0 * info['commits'] / totalcommits)))
1059
 		f.write('</table></div>')
1059
 		f.write('</table></div>')
1060
-		f.write('<img src="domains.png" alt="Commits by Domains" />')
1060
+		f.write('<img src="domains.png" alt="Commits by Domains">')
1061
 		fp.close()
1061
 		fp.close()
1062
 
1062
 
1063
 		f.write('</body></html>')
1063
 		f.write('</body></html>')
1094
 		#	fg.write('%s %d\n' % (datetime.datetime.fromtimestamp(stamp).strftime('%Y-%m-%d'), data.files_by_stamp[stamp]))
1094
 		#	fg.write('%s %d\n' % (datetime.datetime.fromtimestamp(stamp).strftime('%Y-%m-%d'), data.files_by_stamp[stamp]))
1095
 		fg.close()
1095
 		fg.close()
1096
 			
1096
 			
1097
-		f.write('<img src="files_by_date.png" alt="Files by Date" />')
1097
+		f.write('<img src="files_by_date.png" alt="Files by Date">')
1098
 
1098
 
1099
 		#f.write('<h2>Average file size by date</h2>')
1099
 		#f.write('<h2>Average file size by date</h2>')
1100
 
1100
 
1126
 		f.write('</dl>\n')
1126
 		f.write('</dl>\n')
1127
 
1127
 
1128
 		f.write(html_header(2, 'Lines of Code'))
1128
 		f.write(html_header(2, 'Lines of Code'))
1129
-		f.write('<img src="lines_of_code.png" />')
1129
+		f.write('<img src="lines_of_code.png">')
1130
 
1130
 
1131
 		fg = open(path + '/lines_of_code.dat', 'w')
1131
 		fg = open(path + '/lines_of_code.dat', 'w')
1132
 		for stamp in sorted(data.changes_by_date.keys()):
1132
 		for stamp in sorted(data.changes_by_date.keys()):
1373
 
1373
 
1374
 	def printHeader(self, f, title = ''):
1374
 	def printHeader(self, f, title = ''):
1375
 		f.write(
1375
 		f.write(
1376
-"""<?xml version="1.0" encoding="UTF-8"?>
1377
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
1378
-<html xmlns="http://www.w3.org/1999/xhtml">
1376
+"""<!DOCTYPE html>
1377
+<html>
1379
 <head>
1378
 <head>
1379
+	<meta charset="UTF-8">
1380
 	<title>GitStats - %s</title>
1380
 	<title>GitStats - %s</title>
1381
-	<link rel="stylesheet" href="%s" type="text/css" />
1382
-	<meta name="generator" content="GitStats %s" />
1383
-	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
1381
+	<link rel="stylesheet" href="%s" type="text/css">
1382
+	<meta name="generator" content="GitStats %s">
1384
 	<script type="text/javascript" src="sortable.js"></script>
1383
 	<script type="text/javascript" src="sortable.js"></script>
1385
 </head>
1384
 </head>
1386
 <body>
1385
 <body>