2

新しい言語を gtksourceview (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 エンティティとバックスラッシュ (\) を使用してみましたが、機能しません。

誰かが何が問題なのか知っていますか?

ありがとう。

4

2 に答える 2

1

属性extend-parent="false"として使用するだけcontext

于 2011-08-23T11:04:56.063 に答える
1

私は問題を見つけました:

別のコンテキストでは%、正規表現にが含まれていたため、%}は解釈されませんでした。

于 2013-01-10T00:49:12.547 に答える