0

I'm working on updating an old Twig mode for Coda. Coda uses most of the SubEthaEdit format for syntax coloring.

But I'm not too good with regex and I'm just learning SubEthaEdit's format. Plus, Panic has not yet documented Coda's use of the format.

So...

I'm starting simple and working on this construct:

{% block header %}

I have the {% and %} selected with:

<keywords id="Template Tag" scope="markup.tag.framework" useforautocomplete="yes"> <regex>({%|%})</regex> </keywords>

I have the block selected with:

<keywords id="Template Tags" scope="keyword.control" useforautocomplete="yes"> <string>block</string> </keywords>

Then I tried:

<keywords id="Variables in Twig" scope="markup.tag.attribute.name" useforautocomplete="no"> <regex>\w</regex> </keywords>

to get the head or any other variable used in that line. But it matches nothing.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Bob Rockefeller
  • 4,492
  • 2
  • 28
  • 35

1 Answers1

0

I think this is the right approach:

<keywords id="Variables in Twig" scope="language.variable" useforautocomplete="no"> <regex>([A-Za-z0-9_.>\-]*)</regex> </keywords>

Could it be improved?

Bob Rockefeller
  • 4,492
  • 2
  • 28
  • 35