Skip to content

Commit

Permalink
Clean up unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
JadedBlueEyes committed Apr 18, 2024
1 parent c2c0e35 commit be57946
Showing 1 changed file with 10 additions and 17 deletions.
27 changes: 10 additions & 17 deletions src/render.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
use std::fs::File;

use axum::{
extract::Path,
http::{header, StatusCode},
response::{IntoResponse, Response},
};
use rust_embed::RustEmbed;

use handlebars::Handlebars;
use mrml::prelude::parser::{loader::IncludeLoader, ParserOptions};
use serde_json::value::Map;

#[derive(RustEmbed, Debug)]
#[folder = "templates"]
Expand Down Expand Up @@ -114,7 +110,12 @@ pub async fn render_text(Path(template_id): Path<String>) -> Result<Response, En
}
}

#[test]
fn render() -> Result<(), Box<dyn std::error::Error>> {
use handlebars::Handlebars;
use serde_json::Map;
use std::fs::File;

let mut handlebars = Handlebars::new();

handlebars
Expand All @@ -128,19 +129,11 @@ fn render() -> Result<(), Box<dyn std::error::Error>> {
let mut output_file = File::create("target/test.html")?;
handlebars.render_to_write("test.hbs", &data, &mut output_file)?;
println!("target/test.html generated");
let opts = ParserOptions {
include_loader: Box::new(TemplateFiles),
};
let root = mrml::parse_with_options("", &opts).expect("parse template");
let opts = mrml::prelude::render::RenderOptions::default();
match root.render(&opts) {
Ok(content) => println!("{}", content),
Err(_) => println!("couldn't render mjml template"),
};

Ok(())
}
fn render_mrml() {
// TODO: Iterate over and prerender all the templates?
// TemplateFiles::iter().map(f)
}

// TODO: Iterate over and prerender all the templates?
// fn render_mrml() {
// TemplateFiles::iter().map(f)
// }

0 comments on commit be57946

Please sign in to comment.