Format better and remove unnecessary borrows
This commit is contained in:
parent
98484f5765
commit
1ca0d79f10
|
@ -49,9 +49,12 @@ impl HtmlHandlebars {
|
||||||
let content = ch.content.clone();
|
let content = ch.content.clone();
|
||||||
let content = utils::render_markdown(&content, ctx.html_config.curly_quotes);
|
let content = utils::render_markdown(&content, ctx.html_config.curly_quotes);
|
||||||
|
|
||||||
let fixed_content =
|
let fixed_content = utils::render_markdown_with_path(
|
||||||
utils::render_markdown_with_path(&ch.content, ctx.html_config.curly_quotes, Some(path));
|
&ch.content,
|
||||||
if !ctx.is_index && ctx.html_config.print.page_break {
|
ctx.html_config.curly_quotes,
|
||||||
|
Some(path),
|
||||||
|
);
|
||||||
|
if !ctx.is_index {
|
||||||
// Add page break between chapters
|
// Add page break between chapters
|
||||||
// See https://developer.mozilla.org/en-US/docs/Web/CSS/break-before and https://developer.mozilla.org/en-US/docs/Web/CSS/page-break-before
|
// See https://developer.mozilla.org/en-US/docs/Web/CSS/break-before and https://developer.mozilla.org/en-US/docs/Web/CSS/page-break-before
|
||||||
// Add both two CSS properties because of the compatibility issue
|
// Add both two CSS properties because of the compatibility issue
|
||||||
|
@ -613,7 +616,7 @@ impl Renderer for HtmlHandlebars {
|
||||||
let rendered =
|
let rendered =
|
||||||
self.post_process(rendered, &html_config.playground, ctx.config.rust.edition);
|
self.post_process(rendered, &html_config.playground, ctx.config.rust.edition);
|
||||||
|
|
||||||
utils::fs::write_file(&destination, "print.html", rendered.as_bytes())?;
|
utils::fs::write_file(destination, "print.html", rendered.as_bytes())?;
|
||||||
debug!("Creating print.html ✓");
|
debug!("Creating print.html ✓");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -597,9 +597,7 @@ fn edit_url_has_default_src_dir_edit_url() {
|
||||||
let index_html = temp.path().join("book").join("index.html");
|
let index_html = temp.path().join("book").join("index.html");
|
||||||
assert_contains_strings(
|
assert_contains_strings(
|
||||||
index_html,
|
index_html,
|
||||||
&[
|
&[r#"href="https://github.com/rust-lang/mdBook/edit/master/guide/src/README.md" title="Suggest an edit""#],
|
||||||
r#"href="https://github.com/rust-lang/mdBook/edit/master/guide/src/README.md" title="Suggest an edit""#,
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -623,9 +621,7 @@ fn edit_url_has_configured_src_dir_edit_url() {
|
||||||
let index_html = temp.path().join("book").join("index.html");
|
let index_html = temp.path().join("book").join("index.html");
|
||||||
assert_contains_strings(
|
assert_contains_strings(
|
||||||
index_html,
|
index_html,
|
||||||
&[
|
&[r#"href="https://github.com/rust-lang/mdBook/edit/master/guide/src2/README.md" title="Suggest an edit""#],
|
||||||
r#"href="https://github.com/rust-lang/mdBook/edit/master/guide/src2/README.md" title="Suggest an edit""#,
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue