-
Notifications
You must be signed in to change notification settings - Fork 315
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
Switch from Mustache to Handlebars #559
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit moves the templating system from Mustache to Handlebars. It brings us a couple of things: 1) Handlebars is a more flexible templating system; the Rust implementation we are using will allow us to add custom handlers if we want, making it easy to customize the templating system. 2) Handlebars uses the full Javascript true/false behavior on the ``{{if}}`` conditional. That means you can have values that use the empty string evaluate correctly, making it much easier to write templates. 3) Handlebars supports trimming whitespace with ``~`` 4) Handlebars sets us up to support registering all the templates in a plan, and letting you use some as partials. 5) The syntax is slightly more verbose than Mustache. For example: ``` {{#if cfg.your_value}}{{cfg.your_value}}{{/if}} ``` Versus ``` {{#cfg.your_value}}{{cfg.your_value}}{{/cfg.your_value}} ``` (Also, the Mustache version doesn't work unless the value of ``cfg.your_value`` is an array. This sucks. See reason 2) Additionally, I replaced our use of the openssl hash function with the same Blake2B hash we use elsewhere when deciding if we need to re-render a configuration template. Signed-off-by: Adam Jacob <[email protected]>
By analyzing the blame information on this pull request, we identified @reset, @metadave, @fnichol, @juliandunn and @adamhjk to be potential reviewers |
@adamhjk so much nicer than mustache! |
📌 Commit 8e3d079 has been approved by |
thesentinels
pushed a commit
that referenced
this pull request
May 25, 2016
This commit moves the templating system from Mustache to Handlebars. It brings us a couple of things: 1) Handlebars is a more flexible templating system; the Rust implementation we are using will allow us to add custom handlers if we want, making it easy to customize the templating system. 2) Handlebars uses the full Javascript true/false behavior on the ``{{if}}`` conditional. That means you can have values that use the empty string evaluate correctly, making it much easier to write templates. 3) Handlebars supports trimming whitespace with ``~`` 4) Handlebars sets us up to support registering all the templates in a plan, and letting you use some as partials. 5) The syntax is slightly more verbose than Mustache. For example: ``` {{#if cfg.your_value}}{{cfg.your_value}}{{/if}} ``` Versus ``` {{#cfg.your_value}}{{cfg.your_value}}{{/cfg.your_value}} ``` (Also, the Mustache version doesn't work unless the value of ``cfg.your_value`` is an array. This sucks. See reason 2) Additionally, I replaced our use of the openssl hash function with the same Blake2B hash we use elsewhere when deciding if we need to re-render a configuration template. Signed-off-by: Adam Jacob <[email protected]> Pull request: #559 Approved by: reset
☀️ Test successful - travis |
jtimberman
pushed a commit
that referenced
this pull request
Jun 12, 2016
This commit moves the templating system from Mustache to Handlebars. It brings us a couple of things: 1) Handlebars is a more flexible templating system; the Rust implementation we are using will allow us to add custom handlers if we want, making it easy to customize the templating system. 2) Handlebars uses the full Javascript true/false behavior on the ``{{if}}`` conditional. That means you can have values that use the empty string evaluate correctly, making it much easier to write templates. 3) Handlebars supports trimming whitespace with ``~`` 4) Handlebars sets us up to support registering all the templates in a plan, and letting you use some as partials. 5) The syntax is slightly more verbose than Mustache. For example: ``` {{#if cfg.your_value}}{{cfg.your_value}}{{/if}} ``` Versus ``` {{#cfg.your_value}}{{cfg.your_value}}{{/cfg.your_value}} ``` (Also, the Mustache version doesn't work unless the value of ``cfg.your_value`` is an array. This sucks. See reason 2) Additionally, I replaced our use of the openssl hash function with the same Blake2B hash we use elsewhere when deciding if we need to re-render a configuration template. Signed-off-by: Adam Jacob <[email protected]> Pull request: #559 Approved by: reset
raskchanky
pushed a commit
that referenced
this pull request
Apr 16, 2019
This commit moves the templating system from Mustache to Handlebars. It brings us a couple of things: 1) Handlebars is a more flexible templating system; the Rust implementation we are using will allow us to add custom handlers if we want, making it easy to customize the templating system. 2) Handlebars uses the full Javascript true/false behavior on the ``{{if}}`` conditional. That means you can have values that use the empty string evaluate correctly, making it much easier to write templates. 3) Handlebars supports trimming whitespace with ``~`` 4) Handlebars sets us up to support registering all the templates in a plan, and letting you use some as partials. 5) The syntax is slightly more verbose than Mustache. For example: ``` {{#if cfg.your_value}}{{cfg.your_value}}{{/if}} ``` Versus ``` {{#cfg.your_value}}{{cfg.your_value}}{{/cfg.your_value}} ``` (Also, the Mustache version doesn't work unless the value of ``cfg.your_value`` is an array. This sucks. See reason 2) Additionally, I replaced our use of the openssl hash function with the same Blake2B hash we use elsewhere when deciding if we need to re-render a configuration template. Signed-off-by: Adam Jacob <[email protected]> Pull request: #559 Approved by: reset
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a breaking change - any plan that uses anything more complex than variable substitution will break. See Handlebars for new template options, and handlebars-rust for our specific implementation. One tweak is that we do no escaping whatsoever of variables we replace.
This commit moves the templating system from Mustache to Handlebars. It
brings us a couple of things:
Handlebars is a more flexible templating system; the Rust
implementation we are using will allow us to add custom handlers if we
want, making it easy to customize the templating system.
Handlebars uses the full Javascript true/false behavior on the
{{if}}
conditional. That means you can have values that use theempty string evaluate correctly, making it much easier to write
templates.
Handlebars supports trimming whitespace with
~
Handlebars sets us up to support registering all the templates in a
plan, and letting you use some as partials.
The syntax is slightly more verbose than Mustache. For example:
Versus
(Also, the Mustache version doesn't work unless the value of
cfg.your_value
is an array. This sucks. See reason 2)Additionally, I replaced our use of the openssl hash function with the
same Blake2B hash we use elsewhere when deciding if we need to re-render
a configuration template.
Signed-off-by: Adam Jacob [email protected]