Passed through rustfmt
This commit is contained in:
parent
9882700be4
commit
8bb14df2d8
@ -36,7 +36,8 @@ impl HtmlHandlebars {
|
||||
bail!(ErrorKind::ReservedFilenameError(ch.path.clone()));
|
||||
};
|
||||
|
||||
let path = ch.path
|
||||
let path = ch
|
||||
.path
|
||||
.to_str()
|
||||
.chain_err(|| "Could not convert path to str")?;
|
||||
|
||||
@ -45,7 +46,11 @@ impl HtmlHandlebars {
|
||||
|
||||
let string_path = ch.path.parent().unwrap().display().to_string();
|
||||
|
||||
let fixed_content = utils::render_markdown_with_base(&ch.content, ctx.html_config.curly_quotes, &string_path);
|
||||
let fixed_content = utils::render_markdown_with_base(
|
||||
&ch.content,
|
||||
ctx.html_config.curly_quotes,
|
||||
&string_path,
|
||||
);
|
||||
print_content.push_str(&fixed_content);
|
||||
|
||||
// Update the context with data for this file
|
||||
@ -511,7 +516,8 @@ fn build_header_links(html: &str) -> String {
|
||||
.expect("Regex should ensure we only ever get numbers here");
|
||||
|
||||
wrap_header_with_link(level, &caps[2], &mut id_counter)
|
||||
}).into_owned()
|
||||
})
|
||||
.into_owned()
|
||||
}
|
||||
|
||||
/// Wraps a single header tag with a link, making sure each tag gets its own
|
||||
@ -562,7 +568,8 @@ fn fix_code_blocks(html: &str) -> String {
|
||||
classes = classes,
|
||||
after = after
|
||||
)
|
||||
}).into_owned()
|
||||
})
|
||||
.into_owned()
|
||||
}
|
||||
|
||||
fn add_playpen_pre(html: &str, playpen_config: &Playpen) -> String {
|
||||
@ -598,7 +605,8 @@ fn add_playpen_pre(html: &str, playpen_config: &Playpen) -> String {
|
||||
// not language-rust, so no-op
|
||||
text.to_owned()
|
||||
}
|
||||
}).into_owned()
|
||||
})
|
||||
.into_owned()
|
||||
}
|
||||
|
||||
fn partition_source(s: &str) -> (String, String) {
|
||||
@ -635,7 +643,6 @@ mod tests {
|
||||
use super::*;
|
||||
use book::Chapter;
|
||||
|
||||
|
||||
#[test]
|
||||
fn original_build_header_links() {
|
||||
let inputs = vec![
|
||||
@ -678,7 +685,6 @@ mod tests {
|
||||
|
||||
impl<'a> PathTestContext<'a> {
|
||||
pub fn new(path: String, dummy_handlebars: &'a Handlebars) -> PathTestContext<'a> {
|
||||
|
||||
PathTestContext {
|
||||
render_context: RenderItemContext {
|
||||
handlebars: dummy_handlebars,
|
||||
@ -687,14 +693,12 @@ mod tests {
|
||||
is_index: false,
|
||||
html_config: HtmlConfig {
|
||||
..Default::default()
|
||||
}
|
||||
},
|
||||
item : BookItem::Chapter(
|
||||
Chapter {
|
||||
},
|
||||
item: BookItem::Chapter(Chapter {
|
||||
path: PathBuf::from(path),
|
||||
..Default::default()
|
||||
}
|
||||
),
|
||||
}),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -707,7 +711,10 @@ mod tests {
|
||||
|
||||
let mut content = String::new();
|
||||
match html_handlebars.render_item(&ctx.item, ctx.render_context, &mut content) {
|
||||
Ok(_) => assert!(false, "Expected a failure, because print.md is a reserved filename"),
|
||||
Ok(_) => assert!(
|
||||
false,
|
||||
"Expected a failure, because print.md is a reserved filename"
|
||||
),
|
||||
Err(error) => assert_eq!(error.to_string(), "print.md is reserved for internal use"),
|
||||
};
|
||||
}
|
||||
@ -728,7 +735,10 @@ mod tests {
|
||||
|
||||
let mut content = String::new();
|
||||
match html_handlebars.render_item(&ctx.item, ctx.render_context, &mut content) {
|
||||
Ok(_) => assert!(false, "Expected a failure in PathBuf::to_str (for BookItem::Chapter::path)"),
|
||||
Ok(_) => assert!(
|
||||
false,
|
||||
"Expected a failure in PathBuf::to_str (for BookItem::Chapter::path)"
|
||||
),
|
||||
Err(error) => assert_eq!(error.to_string(), "Could not convert path to str"),
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user