|
@@ -116,6 +116,32 @@ sub gen_line_nums($$$) {
|
|
|
|
|
|
}
|
|
|
|
|
|
+sub gen_raw_html($$$) {
|
|
|
+
|
|
|
+ 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\">";
|
|
|
+ foreach my $line ( split("\n", $raw_file) ) {
|
|
|
+ if ($line ne "") {
|
|
|
+ $line = check_for_html($line);
|
|
|
+ }
|
|
|
+ print $fh "$line<br>";
|
|
|
+ }
|
|
|
+
|
|
|
+ print $fh "</pre></div><html>";
|
|
|
+ close $fh;
|
|
|
+
|
|
|
+ $logger->info("Generated HTML file for $filename");
|
|
|
+ return $html_file;
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
sub gen_diff_colors($$$) {
|
|
|
|
|
|
my $raw_diff = shift;
|
|
@@ -198,18 +224,22 @@ sub write_project_content($$$$$) {
|
|
|
append_file("<b>Files for $projects_map{$project_path}</b><br>",$project_index);
|
|
|
append_file("<hr/>",$project_index);
|
|
|
## Write files ##
|
|
|
- append_file("<table><div id=\"cotent\"><table id=\"index\"><thead><tr><td><b>File</b></td><td><b>Commit</b></td></tr></thead><tbody>",$project_index);
|
|
|
+ append_file("<table><div id=\"cotent\"><table id=\"index\"><thead><tr><td><b>File</b></td><td><b>Commit</b></td><td><b>Raw</b></td></tr></thead><tbody>",$project_index);
|
|
|
foreach my $filename ( sort keys %$file_content_ref ) {
|
|
|
my $browserCompat = $filename . ".html";
|
|
|
+ my $browserCompatRaw = $filename . "_raw" . ".html";
|
|
|
# Rewrite dir paths so we can save on disk without producing actual dir structure
|
|
|
if ( $filename =~ m/\// ) {
|
|
|
my $copy = $filename;
|
|
|
$copy =~ s/\//_/g;
|
|
|
$browserCompat = $copy . ".html";
|
|
|
+ $browserCompatRaw = $copy . "_raw" . ".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><td><a href=\"$browserCompatRaw\">raw</a></td>",$project_index);
|
|
|
my $html_file = gen_line_nums(${$file_content_ref}{$filename},$filename,$logger);
|
|
|
write_file("$html_file",$spec_web_dir . $browserCompat);
|
|
|
+ my $raw_html_file = gen_raw_html(${$file_content_ref}{$filename},$filename,$logger);
|
|
|
+ write_file("$raw_html_file",$spec_web_dir . $browserCompatRaw);
|
|
|
}
|
|
|
|
|
|
append_file("</tr></tbody></table></div></body>",$project_index);
|