Skip to content

Align mustache tag scope with other languages #46

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

Merged
merged 2 commits into from
Dec 18, 2024
Merged

Align mustache tag scope with other languages #46

merged 2 commits into from
Dec 18, 2024

Conversation

deathaxe
Copy link
Member

This PR modifies mustache tag scopes to align with majority of template
languages, which already use meta.embedded or meta.embedded.expression.

Motivation is a common scope for embedded template code.
Various template languages support both, control flow like statements
and string interpolations while not always being able to reliably distinguish
both syntax-wise.

Another aspect is embedded languages (e.g. JavaScript) also supporting native
string interpolation. Hence a distinction between embedded template code and
such native interpolations seems useful.

Overview

At the time of writing...

Language statement blocks expressions/interpolations
ASP <% meta.embedded %> <%= meta.embedded %>
Astro n.v. { meta.interpolation }
Blade @meta.embedded {{ meta.interpolation }}
ERB <% meta.embedded %> <%- meta.embedded %>
Go Templates {{ if meta.interpolation }} {{ meta.interpolation }}
Handlebars {# meta.embedded}, {/meta.embedded} {{ meta.embedded }}
Jinja2 {% meta.embedded.statement %} {{ meta.embedded.expression }}
JSP <% meta.embedded.scriptlet %> <%= meta.embedded.expression %>
Liquid {% meta.embedded %} {{ meta.interpolation }}
Mustache n.v. {{ meta.embedded.expression }}
Ngx @meta.embedded.statement {{ meta.embedded.expression }}
PHP <? meta.embedded.statement ?> <?= meta.embedded.expression ?>
Svelte {# meta.embedded}, {/meta.embedded} {{ meta.embedded }}
Twig {% meta.embedded.statement %} {{ meta.embedded.expression }}
Vue n.v. {{ meta.embedded.expression }}

This commit modifies mustache tag scopes to align with majority of template
languages, which already use `meta.embedded` or `meta.embedded.expression`.

Motivation is a common scope for embedded template code.
Various template languages support both, control flow like statements
and string interpolations while not always being able to reliably distinguish
both syntax-wise.

Another aspect is embedded languages (e.g. JavaScript) also supporting native
string interpolation. Hence a distinction between embedded template code and
such native interpolations seems useful.
@deathaxe deathaxe merged commit c62e60b into main Dec 18, 2024
6 checks passed
deathaxe added a commit that referenced this pull request Dec 18, 2024
Align mustache tag scope with other languages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant