samuelcolvin / jinjahtml-vscode

Syntax highlighting for jinja(2) html templates in vscode
https://marketplace.visualstudio.com/items?itemName=samuelcolvin.jinjahtml
MIT License
135 stars 55 forks source link

Tera (Rust engine for J2) support #103

Open rimutaka opened 2 years ago

rimutaka commented 2 years ago

I'd like to submit a PR with a few minor fixes for Tera syntax(https://tera.netlify.app/) which is based on J2. I'm not sure if I should do that in source.jinja or create a new set of rules for something like .tera.j2.

  1. <option {% if langs | length==1 %}selected{% endif %}></option> image

  2. <option {% if langs | length < 3 %}selected{% endif %}></option> image

  3. <option value="+12" {% if availability_tz and availability_tz is ending_with('+12') %}selected{% endif %}>New Zealand, UTC+12</option> image

@Keats, Vincent, you probably know if this syntax is valid in both or is Tera-specific. It may be worth mentioning this extension in Tera docs. It seems to work pretty well.

Keats commented 2 years ago

It should be valid in both. Tbh, I just set my templates to use jinja2 syntax and I've never really needed more.