archive
/
md-pdf-rs
Archived
1
Fork 0

Add some additional config

This commit is contained in:
Jake Howard 2017-12-21 20:13:51 +00:00
parent ffbb4ca842
commit 33e76a42dd
Signed by: jake
GPG Key ID: 57AFB45680EDD477
4 changed files with 7 additions and 0 deletions

1
Cargo.lock generated
View File

@ -276,6 +276,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
name = "md-pdf"
version = "0.1.0"
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)",
"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)",

View File

@ -15,6 +15,7 @@ serde_yaml = "0.7.1"
wkhtmltopdf = "0.3.0"
zip = "0.2.6"
tera = "0.10.10"
chrono = "0.4.0"
[build-dependencies]
include_dir = "0.1.3"

View File

@ -10,6 +10,7 @@ extern crate sciter;
extern crate zip;
extern crate mktemp;
extern crate tera;
extern crate chrono;
use std::io::{self, Write};
use std::process::exit;

View File

@ -1,12 +1,16 @@
use tera::{Tera, Context};
use config::Config;
use tera::Result;
use chrono::{Local, DateTime};
const TEMP_TEMPLATE_FILENAME: &str = "index.html";
fn build_context(config: &Config) -> Context {
let mut context = Context::new();
let now: DateTime<Local> = Local::now();
context.add("config", &config);
context.add("now", &now.to_rfc3339());
context.add("version", &String::from(crate_version!()));
return context;
}