Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a different template engine #8

Closed
breard-r opened this issue Oct 13, 2019 · 1 comment
Closed

Use a different template engine #8

breard-r opened this issue Oct 13, 2019 · 1 comment
Labels
dependencies Pull requests that update a dependency file enhancement New feature or request

Comments

@breard-r
Copy link
Owner

breard-r commented Oct 13, 2019

Overview

This issue tracks the criteria the template engine used to render hooks should have and which are eligible. At time of writing, none is eligible, hence the current one is kept. Please submit other crates if they are worth investigating.

Features

Dynamic templates

The crate does not require to have the templates at compile time. Hooks are defined by the user, therefore their templates are not available when ACMEd is compiled.

Jinja2-like

I really like the Jinja2 style. Not all features are required, only the most basics (variables display, basic tests and loops).

Does not have many dependencies

See issue #1
Dependencies of dependencies are counted too.

Method to count dependencies:

  • Create a new empty project using cargo new --bin test_<lib_name>
  • Add the lib to the Cargo.toml file
  • Run cargo build
  • Run cargo tree | grep -v '*' | wc -l | sed 's/$/-2/' | bc

The minus 2 is intended to remove the project and the library itself from the count.

  • ✔️ : n ≤ 5
  • ✅ : 5 < n ≤ 10
  • ⚠️ : 10 < n ≤ 30
  • ❌ : 30 < n

Does not depends on pest

ACMEd already uses nom and should not depend on a second parser.

Comparison table

Crate Dynamic templates Jinja2-like Dependencies No pest Comment
askama ✔️ 33 ❌ ✔️ Impossible to use in ACMEd
tera ✔️ ✔️ 89 ❌ Would use if fewer dependencies and pest wouldn't be one of them
liquid ✔️ ✔️ 115 ❌ Would use if fewer dependencies and pest wouldn't be one of them
templar ✔️ ✔️ 43 ❌ Current version (0.5) unusable because of debug print
tinytemplate ✔️ ⚠️ 10 ✔️ ✔️ Quite simple and effective
ramhorns ✔️ 19 ⚠️ ✔️ Would use if it was a Jinja2-like and had a little fewer dependencies
handlebars ✔️ 45 ❌ Currently used
@breard-r breard-r added dependencies Pull requests that update a dependency file enhancement New feature or request help wanted Extra attention is needed labels Oct 10, 2020
@breard-r
Copy link
Owner Author

Added templar and tinytemplate. The later seems promising, I'll do more testing on it since it may be the best choice.

@breard-r breard-r removed the help wanted Extra attention is needed label Apr 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant