Skip to content

Commit

Permalink
Add tera-text-filters.
Browse files Browse the repository at this point in the history
  • Loading branch information
atholbro committed Jul 5, 2022
1 parent df2d817 commit a2bb009
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
26 changes: 26 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ memchr = "2"
regex = "1"
serde = {version = "1", features = ["derive"]}
tera = "1"
tera-text-filters = "1.0.0"
term = "0.7"
toml = "0.5"
walkdir = "2"
Expand Down
5 changes: 4 additions & 1 deletion src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ pub fn render_one_off_template(
context: &Context,
path: Option<PathBuf>,
) -> Result<String> {
Tera::one_off(content, context, false)
let mut tera = Tera::default();
tera_text_filters::register_all(&mut tera);

tera.render_str(content, context)
.map_err(|err| new_error(ErrorKind::Tera { err, path }))
}

Expand Down

0 comments on commit a2bb009

Please sign in to comment.