Skip to content

Commit

Permalink
Ready for v1.18 (Keats#818)
Browse files Browse the repository at this point in the history
  • Loading branch information
Keats authored Mar 8, 2023
1 parent 378bed7 commit 226d010
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 8 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 1.18.0 (2023-03-08)

- Add `abs` filter
- Add `indent` filter
- Deprecate `get_json_pointer` in favour of `dotted_pointer`, a faster alternative
- Always canonicalize glob paths passed to Tera to workaround a globwalk bug
- Handle apostrophes in title case filter
- Some performance improvement

## 1.17.1 (2022-09-19)

- Make `get_random` use isize instead of i32 and bad error message
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tera"
version = "1.17.1"
version = "1.18.0"
authors = ["Vincent Prouillet <hello@prouilletvincent.com>"]
license = "MIT"
readme = "README.md"
Expand Down
8 changes: 3 additions & 5 deletions src/builtins/filters/number.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@ use crate::errors::{Error, Result};
pub fn abs(value: &Value, _: &HashMap<String, Value>) -> Result<Value> {
if value.as_u64().is_some() {
Ok(value.clone())
} else if let Some(num) = value.as_i64() {
} else if let Some(num) = value.as_i64() {
Ok(to_value(num.abs()).unwrap())
} else if let Some(num) = value.as_f64() {
} else if let Some(num) = value.as_f64() {
Ok(to_value(num.abs()).unwrap())
} else {
Err(Error::msg(
"Filter `abs` was used on a value that isn't a number.",
))
Err(Error::msg("Filter `abs` was used on a value that isn't a number."))
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ impl<'a> Iterator for PointerMachina<'a> {
}
}

/// Looksup a dotted path in a json value
/// Lookups a dotted path in a json value
/// contrary to the json slash pointer it's not allowed to begin with a dot
#[inline]
#[must_use]
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ pub use crate::errors::{Error, ErrorKind, Result};
#[doc(hidden)]
pub use crate::context::dotted_pointer;
#[doc(hidden)]
#[allow(deprecated)]
pub use crate::context::get_json_pointer;
#[doc(hidden)]
pub use crate::template::Template;
Expand Down
2 changes: 1 addition & 1 deletion src/tera.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ impl Tera {
}

let filepath = path
.strip_prefix(parent_dir)
.strip_prefix(&parent_dir)
.unwrap()
.to_string_lossy()
// unify on forward slash
Expand Down

0 comments on commit 226d010

Please sign in to comment.