Skip to content

Commit

Permalink
Auto merge of #14772 - hcbarker:issue-14764-fix, r=weihanglo
Browse files Browse the repository at this point in the history
chore: update handlebars to v6, fix build error

`DirectorySourceOptions` is marked as `#[non_exhaustive]`, and only exposes the Default trait, so we need to instantiate a mutable instance using `default()`, and then change `tpl_extension` to the value we want.

Fixes #14764
  • Loading branch information
bors committed Nov 1, 2024
2 parents 0310497 + 9b4f03a commit 3728f06
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
20 changes: 18 additions & 2 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 @@ -50,7 +50,7 @@ git2 = "0.19.0"
git2-curl = "0.20.0"
gix = { version = "0.67.0", default-features = false, features = ["blocking-http-transport-curl", "progress-tree", "parallel", "dirwalk"] }
glob = "0.3.1"
handlebars = { version = "5.1.2", features = ["dir_source"] }
handlebars = { version = "6.0.0", features = ["dir_source"] }
hex = "0.4.3"
hmac = "0.12.1"
home = "0.5.9"
Expand Down
7 changes: 2 additions & 5 deletions crates/mdman/src/hbs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,8 @@ pub fn expand(file: &Path, formatter: FormatterRef<'_>) -> Result<String, Error>
handlebars.register_decorator("set", Box::new(set_decorator));
handlebars.register_template_file("template", file)?;
let includes = file.parent().unwrap().join("includes");
let options = DirectorySourceOptions {
tpl_extension: ".md".to_string(),
hidden: false,
temporary: false,
};
let mut options = DirectorySourceOptions::default();
options.tpl_extension = ".md".to_string();
handlebars.register_templates_directory(includes, options)?;
let man_name = file
.file_stem()
Expand Down

0 comments on commit 3728f06

Please sign in to comment.