Browse Source

Cleaned up file/commit display slightly with hr tag

spesk1 4 years ago
parent
commit
37f54811d4
1 changed files with 10 additions and 7 deletions
  1. 10 7
      lib/Gsg/Html.pm

+ 10 - 7
lib/Gsg/Html.pm

@@ -84,16 +84,17 @@ sub check_for_html($) {
 }
 }
 
 
 
 
-sub gen_line_nums($$) {
+sub gen_line_nums($$$) {
 
 
 	my $raw_file = shift;
 	my $raw_file = shift;
+	my $filename = shift;
 	my $logger = shift;
 	my $logger = shift;
 
 
 	my $html_file;
 	my $html_file;
 	# Might be a better way to do this? TODO
 	# Might be a better way to do this? TODO
 	open my $fh, '>>', \$html_file or die "Can't open variable: $!";
 	open my $fh, '>>', \$html_file or die "Can't open variable: $!";
 	
 	
-	print $fh "<!DOCTYPE html><html><div id=\"content\"><pre id=\"blob\">";
+	print $fh "<!DOCTYPE html><html><b>$filename</b><hr/><div id=\"content\"><pre id=\"blob\">";
 	my $line_counter = 1;
 	my $line_counter = 1;
 	foreach my $line ( split("\n", $raw_file) ) {
 	foreach my $line ( split("\n", $raw_file) ) {
 		if ( $line ne "" ) {
 		if ( $line ne "" ) {
@@ -106,21 +107,22 @@ sub gen_line_nums($$) {
 	print $fh "</pre></div><html>";
 	print $fh "</pre></div><html>";
 	close $fh;
 	close $fh;
 
 
-	$logger->info("Generated line numbers for file");
+	$logger->info("Generated line numbers for $filename");
 	return $html_file;
 	return $html_file;
 
 
 }
 }
 
 
-sub gen_diff_colors($$) {
+sub gen_diff_colors($$$) {
 
 
 	my $raw_diff = shift;
 	my $raw_diff = shift;
+	my $id = shift;
 	my $logger = shift;
 	my $logger = shift;
 
 
 	my $html_diff;
 	my $html_diff;
 	open my $fh, '>>', \$html_diff or die "Can't open variable: $!";
 	open my $fh, '>>', \$html_diff or die "Can't open variable: $!";
 
 
 	#print $fh "<!DOCTYPE html><html><div id=\"content\"><pre id=\"blob\">";
 	#print $fh "<!DOCTYPE html><html><div id=\"content\"><pre id=\"blob\">";
-	print $fh "<!DOCTYPE html><html><div id=\"content\"><pre>";
+	print $fh "<!DOCTYPE html><html><b>$id</b><hr/><div id=\"content\"><pre>";
 	my $line_counter = 1;
 	my $line_counter = 1;
 	foreach my $line ( split("\n", $raw_diff) ) {
 	foreach my $line ( split("\n", $raw_diff) ) {
 		if ( $line ne "" ) {
 		if ( $line ne "" ) {
@@ -146,6 +148,7 @@ sub gen_diff_colors($$) {
 	print $fh "</pre></div></html>";
 	print $fh "</pre></div></html>";
 	close $fh;
 	close $fh;
 
 
+	$logger->info("Generated colored diff for $id");
 	return $html_diff;
 	return $html_diff;
 
 
 }
 }
@@ -195,7 +198,7 @@ sub write_project_content($$$$) {
 				$browserCompat = $copy . ".html";
 				$browserCompat = $copy . ".html";
 			}
 			}
 			append_file("<tr><td><a href=\"$browserCompat\">$filename</a></td><td>${$file_tree_ref}{$filename}</td>",$project_index);
 			append_file("<tr><td><a href=\"$browserCompat\">$filename</a></td><td>${$file_tree_ref}{$filename}</td>",$project_index);
-			my $html_file = gen_line_nums(${$file_content_ref}{$filename},$logger);
+			my $html_file = gen_line_nums(${$file_content_ref}{$filename},$filename,$logger);
 			write_file("$html_file",$spec_web_dir . $browserCompat);
 			write_file("$html_file",$spec_web_dir . $browserCompat);
 		}
 		}
 
 
@@ -210,7 +213,7 @@ sub write_project_content($$$$) {
 	foreach my $commit_id ( @$commit_ids_ref ) {
 	foreach my $commit_id ( @$commit_ids_ref ) {
 		my $filename = $commit_id . ".html";
 		my $filename = $commit_id . ".html";
 		append_file("<tr><td><a href=\"$filename\">$filename</a></td>",$project_index);
 		append_file("<tr><td><a href=\"$filename\">$filename</a></td>",$project_index);
-		my $html_diff = gen_diff_colors(${$commits_ref}{$commit_id},$logger);
+		my $html_diff = gen_diff_colors(${$commits_ref}{$commit_id},$commit_id,$logger);
 		write_file($html_diff,$spec_web_dir . $filename);
 		write_file($html_diff,$spec_web_dir . $filename);
         }
         }
         append_file("</tr></tbody></table></div></body>",$project_index);
         append_file("</tr></tbody></table></div></body>",$project_index);