2010-07-17 108 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