0

So I'm able to match/color {{#if media.isMobile}} and it's end tag {{/if}}. But everything in between the blocks is just regular text now (Before it had nice html coloring). So how do I get the content inbetween the captures to be captured using the top level of the dictionary (Since everything not within the tags still has proper color)?

Here's my language pattern code for if, incase you need

<key>if_token</key>
    <dict>
        <key>begin</key>
        <string>(\{\{#)(if) (.+)(\}\})</string>
        <key>beginCaptures</key>
        <dict>
            <key>1</key>
            <dict>
                <key>name</key>
                <string>>punctuation.definition.tag.begin.html</string>
            </dict>
            <key>2</key>
            <dict>
                <key>name</key>
                <string>keyword.operator.handlebars</string>
            </dict>
            <key>3</key>
            <dict>
                <key>name</key>
                <string>variable.parameter.handlebars</string>
            </dict>
            <key>4</key>
            <dict>
                <key>name</key>
                <string>punctuation.definition.tag.end.html</string>
            </dict>
        </dict>
        <key>end</key>
        <string>(\{\{\/)(if)(}})</string>
        <key>endCaptures</key>
        <dict>
            <key>1</key>
            <dict>
                <key>name</key>
                <string>punctuation.definition.tag.begin.html</string>
            </dict>
            <key>2</key>
            <dict>
                <key>name</key>
                <string>keyword.operator.handlebars</string>
            </dict>
            <key>3</key>
            <dict>
                <key>name</key>
                <string>punctuation.definition.tag.end.html</string>
            </dict>               
        </dict>

    </dict>
4

1 回答 1

1

弄清楚了。而不是捕获整个块。捕获 Begin:{{#if ..和 End:}}作为一个模式。而{{/if}}作为另一个。

于 2016-04-12T14:58:39.877 回答