Skip to content

Commit ca74d60

Browse files
committed
cleanup & fmt
1 parent f593f45 commit ca74d60

File tree

3 files changed

+13
-15
lines changed

3 files changed

+13
-15
lines changed

src/renderer/html_handlebars/hbs_renderer.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
11
use crate::book::{Book, BookItem};
2-
use crate::config::{Config, HtmlConfig, Playpen};
2+
use crate::config::{Config, HtmlConfig};
33
use crate::errors::*;
4-
use crate::renderer::html_handlebars::hbs_wrapper::{HbsWrapper, HbsConfig};
5-
use crate::renderer::html_handlebars::helpers;
4+
use crate::renderer::html_handlebars::hbs_wrapper::{HbsConfig, HbsWrapper};
65
use crate::renderer::{RenderContext, Renderer};
76
use crate::theme::{self, playpen_editor, Theme};
87
use crate::utils;
98

109
use std::collections::BTreeMap;
11-
use std::collections::HashMap;
1210
use std::fs;
1311
use std::path::{Path, PathBuf};
1412

15-
use regex::{Captures, Regex};
16-
17-
1813
#[derive(Default)]
1914
pub struct HtmlHandlebars;
2015

@@ -77,7 +72,9 @@ impl HtmlHandlebars {
7772

7873
// Render the handlebars template with the data
7974
debug!("Render template");
80-
let rendered = ctx.handlebars.render("index", &ctx.data, &ctx.html_config.playpen)?;
75+
let rendered = ctx
76+
.handlebars
77+
.render("index", &ctx.data, &ctx.html_config.playpen)?;
8178

8279
// Write to file
8380
debug!("Creating {}", filepath.display());
@@ -86,7 +83,9 @@ impl HtmlHandlebars {
8683
if ctx.is_index {
8784
ctx.data.insert("path".to_owned(), json!("index.md"));
8885
ctx.data.insert("path_to_root".to_owned(), json!(""));
89-
let rendered_index = ctx.handlebars.render("index", &ctx.data, &ctx.html_config.playpen)?;
86+
let rendered_index =
87+
ctx.handlebars
88+
.render("index", &ctx.data, &ctx.html_config.playpen)?;
9089
debug!("Creating index.html from {}", path);
9190
utils::fs::write_file(&ctx.destination, "index.html", rendered_index.as_bytes())?;
9291
}

src/renderer/html_handlebars/hbs_wrapper.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use super::helpers;
2-
use crate::errors::{Result};
32
use crate::config::Playpen;
3+
use crate::errors::Result;
44
use crate::utils;
55
use handlebars::Handlebars;
6-
use regex::{Regex, Captures};
7-
use std::collections::HashMap;
6+
use regex::{Captures, Regex};
87
use serde::Serialize;
8+
use std::collections::HashMap;
99

1010
#[derive(Debug)]
1111
pub struct HbsConfig {
@@ -16,7 +16,7 @@ pub struct HbsConfig {
1616

1717
#[derive(Debug)]
1818
pub struct HbsWrapper {
19-
handlebars: Handlebars
19+
handlebars: Handlebars,
2020
}
2121

2222
impl HbsWrapper {
@@ -170,7 +170,6 @@ fn add_playpen_pre(html: &str, playpen_config: &Playpen) -> String {
170170
.into_owned()
171171
}
172172

173-
174173
fn partition_source(s: &str) -> (String, String) {
175174
let mut after_header = false;
176175
let mut before = String::new();

src/renderer/html_handlebars/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
pub use self::hbs_renderer::HtmlHandlebars;
44

5-
mod hbs_wrapper;
65
mod hbs_renderer;
6+
mod hbs_wrapper;
77
mod helpers;
88

99
#[cfg(feature = "search")]

0 commit comments

Comments
 (0)