Skip to content

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.

2 participants