Author Topic: Jinja?  (Read 365 times)

jporkkahtc

  • Senior Community Member
  • Posts: 2158
  • Hero Points: 191
  • Text
Jinja?
« on: July 22, 2020, 05:29:33 pm »
I don't see a language def for Jinja.

I have some *.Jinja macro files that are used it part of a code generator - so this macro code is stand alone, not embedded in anything

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 5702
  • Hero Points: 457
Re: Jinja?
« Reply #1 on: July 22, 2020, 06:16:19 pm »
No Jinja as a stand alone language yet. Didn't know there was such a thing.

Can you post a sample .Jinja macros file?

How is a stand alone Jinja file used?


Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 5702
  • Hero Points: 457
Re: Jinja?
« Reply #2 on: July 24, 2020, 09:18:41 pm »
Your stand alone Jinja sample looks pretty much like embedded code. {% Jinja code ... %}. etc.

The only thing in your Jinja file which is out side of this are some double quoted strings:

Code: [Select]
"Array"{%...%}

Are quoted strings outside of {%...%} part of the Jinja language or just some arbitrary text? There's also a some commas outside of {%...%}. I'm guessing if it's outside of {%...%}, then it's not colored as Jinja.

jporkkahtc

  • Senior Community Member
  • Posts: 2158
  • Hero Points: 191
  • Text
Re: Jinja?
« Reply #3 on: July 24, 2020, 09:46:45 pm »
"Array" appears verbatim (including quotes) in the output -- Jinja doesn't interpret the quotes.
outside of {% %}, double braces {{variable}} are substitutions.

From this: https://jinja.palletsprojects.com/en/2.11.x/templates/#synopsis
Anything outside of these
Code: [Select]
{% ... %} for Statements
{{ ... }} for Expressions to print to the template output
{# ... #} for Comments not included in the template output
#  ... ## for Line Statements
is just plain text.


If I rename my file from "something.jina" to "something.cs" or "something.ps1"
should Slick recognize this is Jinja macros embedded in csharp or powershell script?

jporkkahtc

  • Senior Community Member
  • Posts: 2158
  • Hero Points: 191
  • Text
Re: Jinja?
« Reply #4 on: July 24, 2020, 09:52:50 pm »
yes, renaming the files works - along with toggle_jinja_color_coding!


Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 5702
  • Hero Points: 457
Re: Jinja?
« Reply #5 on: July 24, 2020, 09:56:54 pm »
should Slick recognize this is Jinja macros embedded in csharp or powershell script?

I'm not sure I follow the question (is Jinja embedded in a different way?) Can you post small sample code?
« Last Edit: July 25, 2020, 04:41:44 am by Clark »