37f54811d49d41a4d794594e5bbaaee2271d82ad
commit 37f54811d49d41a4d794594e5bbaaee2271d82ad
Author: spesk1 <spesk@pm.me>
Date: Sat Jun 22 20:14:12 2019 +0000

Cleaned up file/commit display slightly with hr tag

diff --git a/lib/Gsg/Html.pm b/lib/Gsg/Html.pm
index 77014a8..0ab52a0 100644
--- a/lib/Gsg/Html.pm
+++ b/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 $filename = shift;
my $logger = shift;

my $html_file;
# Might be a better way to do this? TODO
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;
foreach my $line ( split("\n", $raw_file) ) {
if ( $line ne "" ) {
@@ -106,21 +107,22 @@ sub gen_line_nums($$) {
print $fh "</pre></div><html>";
close $fh;

- $logger->info("Generated line numbers for file");
+ $logger->info("Generated line numbers for $filename");
return $html_file;

}

-sub gen_diff_colors($$) {
+sub gen_diff_colors($$$) {

my $raw_diff = shift;
+ my $id = shift;
my $logger = shift;

my $html_diff;
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>";
+ print $fh "<!DOCTYPE html><html><b>$id</b><hr/><div id=\"content\"><pre>";
my $line_counter = 1;
foreach my $line ( split("\n", $raw_diff) ) {
if ( $line ne "" ) {
@@ -146,6 +148,7 @@ sub gen_diff_colors($$) {
print $fh "</pre></div></html>";
close $fh;

+ $logger->info("Generated colored diff for $id");
return $html_diff;

}
@@ -195,7 +198,7 @@ sub write_project_content($$$$) {
$browserCompat = $copy . ".html";
}
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);
}

@@ -210,7 +213,7 @@ sub write_project_content($$$$) {
foreach my $commit_id ( @$commit_ids_ref ) {
my $filename = $commit_id . ".html";
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);
}
append_file("</tr></tbody></table></div></body>",$project_index);