2010-07-17 103 views
2

我遇到了一个问题,需要在gtksourceview中添加新语言(由gedit使用)。为gtksourceview添加一种新语言(Django的gedit模板语言)

我想补充的Django的模板语言的东西不起作用:
我不能够让%}停止语法着色。

这里是一个片段:

<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> 

这个片段的颜色正确我的代码,但它不会在%}停止。 它继续着色后,所以有什么问题。

我做了这是工作的一个片段:

<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> 

它工作得很好。

{{}}作品,但%}没有。

我试过用html实体和反斜杠(\),它不起作用。

有人知道可能是什么问题吗?

谢谢。

+0

如果您可以在某处共享您的gtksourceview语言语法文件(或者您已经做过?),那将会很好。 – JanC 2010-08-24 06:30:07

+0

是的,我确实分享过。 您可以在此(法语)主题的第一篇文章中找到它: http://www.siteduzero.com/forum-83-541444-p1-utilisez-gedit-pour-vos-projets-django.html 你必须点击“(cliquez pour afficher)”来查看它。 解释以法语说明(如果需要,请使用Google翻译)。 我很高兴你觉得它有用。 – antoyo 2010-08-29 14:06:33

回答

1

我发现这个问题:

在另一种情况下

,有一个正则表达式一个%,所以%}没有解释。

1

只需使用extend-parent="false"context属性

+1

我解决了我的问题。看看问题的第一行。 – antoyo 2011-08-23 20:21:04

+0

好吧,明白了。不过,我想,我的答案可能是类似症状但另一个原因的解决方案,所以我请求将它留在此处) – 2011-09-04 21:30:03