[TxMt] Pattern priority
Pedro Melo
melo at simplicidade.org
Fri Jun 18 15:31:39 UTC 2010
Hi,
I'm writing a small bundle for a HTML template language I use, Tenjin
(http://www.kuwata-lab.com/tenjin/). So far so good but I ran into a
problem with pattern priority in the language definition.
The relevant part of the grammar is this:
patterns = (
{ include = 'text.html.basic'; },
{ name = 'source.perl.pltenjin.expression';
begin = '(\[==?)';
end = '(=?=\])';
captures = {
1 = { name = 'keyword.control'; };
2 = { name = 'keyword.control'; };
};
patterns = ( { include = 'source.perl'; } );
}
);
I "extend" the text.html.basic language (because most of the file is
HTML) and add Tenjin expression. They are in the format [==? =?=] (the
second = means "raw" output, single = means HTML encoded).
TextMate recognizes perfectly my expressions in the text between tags:
<p>[= $var =]</p> # this is ok
but not when used as a tag attribute value:
<p class="[= $class =]">text</p> # not ok
In the second case, the [= $class =] text is all green, the context is
string.quoted.double.html and not the expected
source.perl.pltenjin.expression.
Is there any way to work around this?
Thanks,
--
Pedro Melo
http://www.simplicidade.org/
xmpp:melo at simplicidade.org
mailto:melo at simplicidade.org
More information about the textmate
mailing list