Sublime-Instincts / BetterJinja

A Sublime Text package that provides enhanced syntax highlighting, completions, snippets & more for Jinja templates.
https://packagecontrol.io/packages/Jinja2
MIT License
15 stars 4 forks source link

Add YAML (Jinja) syntax #19

Closed deathaxe closed 5 months ago

deathaxe commented 5 months ago

This PR suggests to add a YAML (Jinja) syntax, which extends ST's core YAML to embed jinja statements and expressions.

It does by intent not use with_prototype to be able to extend specific YAML contexts in proper ways to maintain meta scoping.

Notes:

  1. It creates a dedicated HTML (Jinja), in order to reduce syntax cache size of YAML (Jinja).
  2. HTML (Jinja) still uses the "push with_prototype" approach. Changing it is out of scope for this PR.
FichteFoll commented 5 months ago

Perhaps the supported syntaxes in the readme should also be updated.

deathaxe commented 5 months ago

Maybe part of the next - somewhat larger step of refactoring HTML as it will automatically cause this package to support CSS/JavaScript/JSON/HTML/YAML automatically - with drastically reduced compiled syntax cache sizes.

nicholas-ochoa commented 5 months ago

Any chance of adding support for Jinja statements or comments? From the Jinja docs:

There are a few kinds of delimiters. The default Jinja delimiters are configured as follows:

{% ... %} for [Statements](https://jinja.palletsprojects.com/en/latest/templates/#list-of-control-structures)

{{ ... }} for [Expressions](https://jinja.palletsprojects.com/en/latest/templates/#expressions) to print to the template output

{# ... #} for [Comments](https://jinja.palletsprojects.com/en/latest/templates/#comments) not included in the template output

https://jinja.palletsprojects.com/en/latest/templates/

deathaxe commented 5 months ago

They already are.

deathaxe commented 5 months ago

Closing in favor of https://github.com/Sublime-Instincts/BetterJinja/pull/22