added css style reference to hayabusa_report.css in html report #689

This commit is contained in:
DastInDark
2022-09-27 15:08:34 +09:00
parent 0058334e60
commit 9e56eb6481
4 changed files with 24 additions and 1 deletions

7
Cargo.lock generated
View File

@@ -769,6 +769,7 @@ dependencies = [
"hashbrown",
"hex",
"hhmmss",
"horrorshow",
"hyper",
"is_elevated",
"itertools",
@@ -827,6 +828,12 @@ dependencies = [
"time 0.2.27",
]
[[package]]
name = "horrorshow"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8371fb981840150b1a54f7cb117bf6699f7466a1d4861daac33bc6fe2b5abea0"
[[package]]
name = "http"
version = "0.2.8"

View File

@@ -41,6 +41,7 @@ num-format = "*"
comfy-table = "6.*"
pulldown-cmark = { version = "0.9.*", default-features = false, features = ["simd"] }
reqwest = {version = "0.11.*", features = ["blocking", "json"]}
horrorshow = "0.8.*"
[build-dependencies]
static_vcruntime = "2.*"

View File

@@ -8,3 +8,5 @@ pub mod timeline;
pub mod yaml;
#[macro_use]
extern crate prettytable;
#[macro_use]
extern crate horrorshow;

View File

@@ -8,6 +8,8 @@ use std::io::BufWriter;
use std::io::Write;
use std::path::Path;
use std::sync::RwLock;
use horrorshow::prelude::*;
use horrorshow::helper::doctype;
lazy_static! {
pub static ref HTML_REPORTER: RwLock<HtmlReporter> = RwLock::new(HtmlReporter::new());
@@ -103,7 +105,18 @@ pub fn create_html_file(input_html: String, path_str: String) {
return;
}
let mut html_writer = BufWriter::new(File::create(path).unwrap());
writeln!(html_writer, "{}", input_html).ok();
let html_data = format!("{}", html! {
: doctype::HTML;
html {
head {
meta(charset="UTF-8");
link(rel="stylesheet", type="text/css", href="./hayabusa_report.css");
}
body : Raw(input_html.clone().as_str())
}
});
writeln!(html_writer,"{}", html_data).ok();
println!(
"HTML Report was generated. Please check {} for details.",
path_str