views:

39

answers:

0

Edit: I found the problem :
in another context, there was a % in a regexp, so the %} was not interpreted.

Hello ! I got a problem to add a new language to gtksourceview (used by gedit).

I want to add the Django's template language and something does not work :
I am not able to make %} stop the syntactic coloring.

Here is a snippet :

<context id="dtl-block" end-at-line-end="true">
    <start>{%</start>
    <end>%}</end>
    <include>
        <context sub-pattern="0" where="start" style-ref="preprocessor"/>
        <context sub-pattern="0" where="end" style-ref="preprocessor"/>
        <context ref="string"/>
        <context ref="chaine"/>
        <context ref="keywords"/>
        <context ref="filters"/>
        <context ref="operators"/>
        <context ref="variable"/>
    </include>
</context>

This snippet color correctly my code, but it does not stop at %}. It continues coloring after %}, so there is something wrong.

I made a snippet which is working :

<context id="variable-block" end-at-line-end="true">
    <start>{{</start>
    <end>}}</end>
    <include>
        <context sub-pattern="0" where="start" style-ref="preprocessor"/>
        <context sub-pattern="0" where="end" style-ref="preprocessor"/>
        <context ref="variable"/>
    </include>
</context>

It is working very well.

{{ and }} works, but %} does not.

I tried with html entities and with a backslash (\) and it does not work.

Does somebody know what could be the problem ?

Thanks.