diff --git a/src/app.rs b/src/app.rs index 277331e..d281d58 100644 --- a/src/app.rs +++ b/src/app.rs @@ -36,6 +36,21 @@ pub struct Config { resume_fname: PathBuf, } +pub fn markdown(inp: &str) -> String { + let mut options = ComrakOptions::default(); + + options.extension.autolink = true; + options.extension.table = true; + options.extension.description_lists = true; + options.extension.superscript = true; + options.extension.strikethrough = true; + options.extension.footnotes = true; + + options.render.unsafe_ = true; + + markdown_to_html(inp, &options) +} + pub struct State { pub cfg: Config, pub signalboost: Vec, @@ -46,20 +61,7 @@ pub fn init<'a>() -> Result { let cfg: Config = envy::from_env()?; let sb = serde_dhall::from_file(cfg.signalboost_fname.clone()).parse()?; let resume = fs::read_to_string(cfg.resume_fname.clone())?; - let resume: String = { - let mut options = ComrakOptions::default(); - - options.extension.autolink = true; - options.extension.table = true; - options.extension.description_lists = true; - options.extension.superscript = true; - options.extension.strikethrough = true; - options.extension.footnotes = true; - - options.render.unsafe_ = true; - - markdown_to_html(&resume, &options) - }; + let resume: String = markdown(&resume); Ok(State { cfg: cfg, diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs index 4cd87f7..0cd7422 100644 --- a/src/handlers/mod.rs +++ b/src/handlers/mod.rs @@ -1,12 +1,9 @@ use crate::{ app::State, - templates::{self, RenderRucte, Html}, + templates::{self, Html, RenderRucte}, }; use std::sync::Arc; -use warp::{ - http::{Response, StatusCode}, - path, Filter, Rejection, Reply, -}; +use warp::{http::Response, Rejection, Reply}; pub async fn index() -> Result { Response::builder().html(|o| templates::index_html(o)) diff --git a/templates/resume.rs.html b/templates/resume.rs.html index 5067cf3..60e31ff 100644 --- a/templates/resume.rs.html +++ b/templates/resume.rs.html @@ -6,4 +6,8 @@ @resume +
+ +Plain-text version of this resume here + @:footer_html()