FAR
Find And Replace string template engine
Overview
Provided with a template and a map, FAR will attempt to find all the keys
(delimited with {{
and }}
) in the template and replace them with the
corresponding value in the map. By default, map values are
rendered by their Display
impl. For example:
# use ;
#
If it fails for some reason, an explanation of why will be returned:
# use ;
// Note the typo ----------------------------> vvvvvvvv
let template = "{{specific}} are my favorite {{catglory}}.";
let errors = .unwrap_err;
assert_eq!;
Template authors can write {{{{}}
or {{}}}}
to get a literal {{
or }}
respectively.
Additional examples and weird edge-case behaviors can be found in
core/src/tests
.
License
This project is licensed under either of
-
Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
-
MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.