11 releases

new 0.1.10 May 15, 2024
0.1.9 May 13, 2024
0.1.6 Apr 19, 2024
0.1.4 Mar 16, 2024
0.1.2 Feb 21, 2024

#138 in Template engine

Download history 98/week @ 2024-02-14 242/week @ 2024-02-21 47/week @ 2024-02-28 133/week @ 2024-03-06 188/week @ 2024-03-13 37/week @ 2024-03-20 85/week @ 2024-03-27 8/week @ 2024-04-03 2/week @ 2024-04-10 250/week @ 2024-04-17 8/week @ 2024-04-24 249/week @ 2024-05-08

507 downloads per month
Used in llmclient

MIT/Apache

24KB
426 lines

Yet Another Simple template engine

Inspired by %nix shell and Java version from some years ago and some code influenced by other Rust templating engines.

Features:

  1. Default delimiters "${" and "}". Can be overridden to anything.
  2. Default values with :- syntax.
  3. Nesting of variables allowed (to 8 levels).
  4. Can use environment variables.
  5. Value lookup order: supplied HashMap, Environment, Default (if supplied).
  6. Plays nicely with serde HashMaps.
  7. Can include files (which can nest). With .inc extension only.
  8. Zero dependencies.
  9. Fast.
  10. Can use multi-valued variables for lists etc. (only through HashMap).
  11. Can check existence of a value and if true give it a default. Useful for HTML forms when variable has a particular value, and this value should be the default selected value.
  12. Provide a list of values, '#' separated, and instantiate multiple instances of variable (at same recursive depth), with successive values.

Please read the API documentation https://docs.rs/stemplate/

No runtime deps