Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update handlebars to 3.0 #1130

Merged
merged 1 commit into from
Mar 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 7 additions & 17 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ chrono = "0.4"
clap = "2.24"
env_logger = "0.6"
error-chain = "0.12"
handlebars = { version = "2.0", default-features = false, features = ["no_dir_source"] }
handlebars = "3.0"
itertools = "0.8"
lazy_static = "1.0"
log = "0.4"
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/html_handlebars/hbs_renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ impl HtmlHandlebars {
);
}

fn register_hbs_helpers(&self, handlebars: &mut Handlebars, html_config: &HtmlConfig) {
fn register_hbs_helpers(&self, handlebars: &mut Handlebars<'_>, html_config: &HtmlConfig) {
handlebars.register_helper(
"toc",
Box::new(helpers::toc::RenderToc {
Expand Down Expand Up @@ -701,7 +701,7 @@ fn partition_source(s: &str) -> (String, String) {
}

struct RenderItemContext<'a> {
handlebars: &'a Handlebars,
handlebars: &'a Handlebars<'a>,
destination: PathBuf,
data: serde_json::Map<String, serde_json::Value>,
is_index: bool,
Expand Down
16 changes: 8 additions & 8 deletions src/renderer/html_handlebars/helpers/navigation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl Target {

fn find_chapter(
ctx: &Context,
rc: &mut RenderContext<'_>,
rc: &mut RenderContext<'_, '_>,
target: Target,
) -> Result<Option<StringMap>, RenderError> {
debug!("Get data from context");
Expand Down Expand Up @@ -108,9 +108,9 @@ fn find_chapter(

fn render(
_h: &Helper<'_, '_>,
r: &Handlebars,
r: &Handlebars<'_>,
ctx: &Context,
rc: &mut RenderContext<'_>,
rc: &mut RenderContext<'_, '_>,
out: &mut dyn Output,
chapter: &StringMap,
) -> Result<(), RenderError> {
Expand Down Expand Up @@ -150,7 +150,7 @@ fn render(
_h.template()
.ok_or_else(|| RenderError::new("Error with the handlebars template"))
.and_then(|t| {
let mut local_rc = rc.new_for_block();
let mut local_rc = rc.clone();
let local_ctx = Context::wraps(&context)?;
t.render(r, &local_ctx, &mut local_rc, out)
})?;
Expand All @@ -160,9 +160,9 @@ fn render(

pub fn previous(
_h: &Helper<'_, '_>,
r: &Handlebars,
r: &Handlebars<'_>,
ctx: &Context,
rc: &mut RenderContext<'_>,
rc: &mut RenderContext<'_, '_>,
out: &mut dyn Output,
) -> Result<(), RenderError> {
trace!("previous (handlebars helper)");
Expand All @@ -176,9 +176,9 @@ pub fn previous(

pub fn next(
_h: &Helper<'_, '_>,
r: &Handlebars,
r: &Handlebars<'_>,
ctx: &Context,
rc: &mut RenderContext<'_>,
rc: &mut RenderContext<'_, '_>,
out: &mut dyn Output,
) -> Result<(), RenderError> {
trace!("next (handlebars helper)");
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/html_handlebars/helpers/theme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ use handlebars::{Context, Handlebars, Helper, Output, RenderContext, RenderError

pub fn theme_option(
h: &Helper<'_, '_>,
_r: &Handlebars,
_r: &Handlebars<'_>,
ctx: &Context,
rc: &mut RenderContext<'_>,
rc: &mut RenderContext<'_, '_>,
out: &mut dyn Output,
) -> Result<(), RenderError> {
trace!("theme_option (handlebars helper)");
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/html_handlebars/helpers/toc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ impl HelperDef for RenderToc {
fn call<'reg: 'rc, 'rc>(
&self,
_h: &Helper<'reg, 'rc>,
_r: &'reg Handlebars,
_r: &'reg Handlebars<'_>,
ctx: &'rc Context,
rc: &mut RenderContext<'reg>,
rc: &mut RenderContext<'reg, 'rc>,
out: &mut dyn Output,
) -> Result<(), RenderError> {
// get value from context data
Expand Down