@@ -436,10 +436,11 @@ class HTMLReportCreator(ReportCreator):
436
436
ReportCreator .create (self , data , path )
437
437
self .title = data .projectname
438
438
439
- # copy the CSS if it does not exist
440
- if not os .path .exists (path + '/gitstats.css' ):
441
- basedir = os .path .dirname (os .path .abspath (__file__ ))
442
- shutil .copyfile (basedir + '/gitstats.css' , path + '/gitstats.css' )
439
+ # copy static files if they do not exist
440
+ for file in ('gitstats.css' , 'sortable.js' , 'arrow-up.gif' , 'arrow-down.gif' , 'arrow-none.gif' ):
441
+ if not os .path .exists (path + '/' + file ):
442
+ basedir = os .path .dirname (os .path .abspath (__file__ ))
443
+ shutil .copyfile (basedir + '/' + file , path + '/' + file )
443
444
444
445
f = open (path + "/index.html" , 'w' )
445
446
format = '%Y-%m-%d %H:%m:%S'
@@ -605,17 +606,17 @@ class HTMLReportCreator(ReportCreator):
605
606
# Authors :: List of authors
606
607
f .write (html_header (2 , 'List of Authors' ))
607
608
608
- f .write ('<table class="authors">' )
609
- f .write ('<tr><th>Author</th><th>Commits (%)</th><th>First commit</th><th>Last commit</th><th>Age</th><th># by commits</th></tr>' )
609
+ f .write ('<table class="authors sortable" id="authors ">' )
610
+ f .write ('<tr><th>Author</th><th>Commits (%)</th><th>First commit</th><th>Last commit</th><th class="unsortable" >Age</th><th># by commits</th></tr>' )
610
611
for author in sorted (data .getAuthors ()):
611
612
info = data .getAuthorInfo (author )
612
613
f .write ('<tr><td>%s</td><td>%d (%.2f%%)</td><td>%s</td><td>%s</td><td>%s</td><td>%d</td></tr>' % (author , info ['commits' ], info ['commits_frac' ], info ['date_first' ], info ['date_last' ], info ['timedelta' ], info ['place_by_commits' ]))
613
614
f .write ('</table>' )
614
615
615
616
# Authors :: Author of Month
616
617
f .write (html_header (2 , 'Author of Month' ))
617
- f .write ('<table>' )
618
- f .write ('<tr><th>Month</th><th>Author</th><th>Commits (%)</th><th>Next top 5</th></tr>' )
618
+ f .write ('<table class="sortable" id="aom" >' )
619
+ f .write ('<tr><th>Month</th><th>Author</th><th>Commits (%)</th><th class="unsortable" >Next top 5</th></tr>' )
619
620
for yymm in reversed (sorted (data .author_of_month .keys ())):
620
621
authordict = data .author_of_month [yymm ]
621
622
authors = getkeyssortedbyvalues (authordict )
@@ -627,7 +628,7 @@ class HTMLReportCreator(ReportCreator):
627
628
f .write ('</table>' )
628
629
629
630
f .write (html_header (2 , 'Author of Year' ))
630
- f .write ('<table><tr><th>Year</th><th>Author</th><th>Commits (%)</th><th>Next top 5</th></tr>' )
631
+ f .write ('<table class="sortable" id="aoy" ><tr><th>Year</th><th>Author</th><th>Commits (%)</th><th class="unsortable" >Next top 5</th></tr>' )
631
632
for yy in reversed (sorted (data .author_of_year .keys ())):
632
633
authordict = data .author_of_year [yy ]
633
634
authors = getkeyssortedbyvalues (authordict )
@@ -667,7 +668,7 @@ class HTMLReportCreator(ReportCreator):
667
668
668
669
# Files :: Extensions
669
670
f .write (html_header (2 , 'Extensions' ))
670
- f .write ('<table><tr><th>Extension</th><th>Files (%)</th><th>Lines (%)</th><th>Lines/file</th></tr>' )
671
+ f .write ('<table class="sortable" id="ext" ><tr><th>Extension</th><th>Files (%)</th><th>Lines (%)</th><th>Lines/file</th></tr>' )
671
672
for ext in sorted (data .extensions .keys ()):
672
673
files = data .extensions [ext ]['files' ]
673
674
lines = data .extensions [ext ]['lines' ]
@@ -850,6 +851,7 @@ plot 'lines_of_code.dat' using 1:2 w lines
850
851
<title>GitStats - %s</title>
851
852
<link rel="stylesheet" href="gitstats.css" type="text/css" />
852
853
<meta name="generator" content="GitStats" />
854
+ <script type="text/javascript" src="sortable.js"></script>
853
855
</head>
854
856
<body>
855
857
""" % self .title )
0 commit comments