Example for template language support

Hey all,

I am looking for an example for how to implement a template language like Liquid, Django/Jinja or Handlebars with Lezer/CM6. All the examples I found so far are for the “old” version.

I am trying to figure out how to define an “interleaved” language, where you have template directives/expressions in-between fragments of a different language such as HTML/XML, for example:

{% if foo %}
  <html in="here">
    {{ some.var }}
  </html>
{% endif %}

Any pointers?

Thanks,
Chris

I’m working on exactly that problem right now, but it’s somewhat involved and it might be a while until I have something usable. So at the moment there’s no real way to work with such languages in CM6.

1 Like

Just a general update: I think I have a working approach now, and am working on overhauling Lezer to support it, but it’s not looking like it will be finished before I leave on vacation next week, so don’t hold your breath.

1 Like

Thanks Marijn, sounds awesome. Looking forward to trying it out! But first, have a nice vacation :slight_smile:

Please take a look at parseMixed in version 0.15 of @lezer/common and see if it helps with your use case.

1 Like