Add some additional config
This commit is contained in:
parent
ffbb4ca842
commit
33e76a42dd
4 changed files with 7 additions and 0 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -276,6 +276,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
name = "md-pdf"
|
name = "md-pdf"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"chrono 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"clap 2.25.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"clap 2.25.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"include_dir 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"include_dir 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"mktemp 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"mktemp 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
|
@ -15,6 +15,7 @@ serde_yaml = "0.7.1"
|
||||||
wkhtmltopdf = "0.3.0"
|
wkhtmltopdf = "0.3.0"
|
||||||
zip = "0.2.6"
|
zip = "0.2.6"
|
||||||
tera = "0.10.10"
|
tera = "0.10.10"
|
||||||
|
chrono = "0.4.0"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
include_dir = "0.1.3"
|
include_dir = "0.1.3"
|
||||||
|
|
|
@ -10,6 +10,7 @@ extern crate sciter;
|
||||||
extern crate zip;
|
extern crate zip;
|
||||||
extern crate mktemp;
|
extern crate mktemp;
|
||||||
extern crate tera;
|
extern crate tera;
|
||||||
|
extern crate chrono;
|
||||||
|
|
||||||
use std::io::{self, Write};
|
use std::io::{self, Write};
|
||||||
use std::process::exit;
|
use std::process::exit;
|
||||||
|
|
|
@ -1,12 +1,16 @@
|
||||||
use tera::{Tera, Context};
|
use tera::{Tera, Context};
|
||||||
use config::Config;
|
use config::Config;
|
||||||
use tera::Result;
|
use tera::Result;
|
||||||
|
use chrono::{Local, DateTime};
|
||||||
|
|
||||||
const TEMP_TEMPLATE_FILENAME: &str = "index.html";
|
const TEMP_TEMPLATE_FILENAME: &str = "index.html";
|
||||||
|
|
||||||
fn build_context(config: &Config) -> Context {
|
fn build_context(config: &Config) -> Context {
|
||||||
let mut context = Context::new();
|
let mut context = Context::new();
|
||||||
|
let now: DateTime<Local> = Local::now();
|
||||||
context.add("config", &config);
|
context.add("config", &config);
|
||||||
|
context.add("now", &now.to_rfc3339());
|
||||||
|
context.add("version", &String::from(crate_version!()));
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue