resume cleanups

This commit is contained in:
Cadey Ratio 2020-07-12 19:30:01 -04:00
parent 160b2ea74e
commit dfc55be049
3 changed files with 22 additions and 19 deletions

View File

@ -36,6 +36,21 @@ pub struct Config {
resume_fname: PathBuf, 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 struct State {
pub cfg: Config, pub cfg: Config,
pub signalboost: Vec<Person>, pub signalboost: Vec<Person>,
@ -46,20 +61,7 @@ pub fn init<'a>() -> Result<State> {
let cfg: Config = envy::from_env()?; let cfg: Config = envy::from_env()?;
let sb = serde_dhall::from_file(cfg.signalboost_fname.clone()).parse()?; let sb = serde_dhall::from_file(cfg.signalboost_fname.clone()).parse()?;
let resume = fs::read_to_string(cfg.resume_fname.clone())?; let resume = fs::read_to_string(cfg.resume_fname.clone())?;
let resume: String = { let resume: String = markdown(&resume);
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)
};
Ok(State { Ok(State {
cfg: cfg, cfg: cfg,

View File

@ -1,12 +1,9 @@
use crate::{ use crate::{
app::State, app::State,
templates::{self, RenderRucte, Html}, templates::{self, Html, RenderRucte},
}; };
use std::sync::Arc; use std::sync::Arc;
use warp::{ use warp::{http::Response, Rejection, Reply};
http::{Response, StatusCode},
path, Filter, Rejection, Reply,
};
pub async fn index() -> Result<impl Reply, Rejection> { pub async fn index() -> Result<impl Reply, Rejection> {
Response::builder().html(|o| templates::index_html(o)) Response::builder().html(|o| templates::index_html(o))

View File

@ -6,4 +6,8 @@
@resume @resume
<hr />
<a href="/static/resume/resume.md">Plain-text version of this resume here</a>
@:footer_html() @:footer_html()