Skip to content

Instantly share code, notes, and snippets.

@xxxObiWan
Created January 30, 2012 21:38
Show Gist options
  • Save xxxObiWan/1706880 to your computer and use it in GitHub Desktop.
Save xxxObiWan/1706880 to your computer and use it in GitHub Desktop.
Sublime Text 2 - syntax highlight for Latte
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array/>
<key>foldingStartMarker</key>
<!-- /------Folding for latte: Start commands -->
<string>(&lt;(?i:(head|table|tr|div|style|script|ul|ol|form|dl))\b.*?&gt;|\{\{?(if|foreach|capture|literal|php|section|strip|block|form)|\{\s*$)</string>
<!--
<string>(&lt;(?i:(head|table|tr|div|style|script|ul|ol|form|dl))\b.*?&gt;|\{\{?(if|foreach|capture|literal|foreach|php|section|strip)|\{\s*$)</string>
-->
<!-- /------ -->
<key>foldingStopMarker</key>
<!-- /------Folding for latte: Stop commands -->
<string>(&lt;/(?i:(head|table|tr|div|style|script|ul|ol|form|dl))&gt;|\{\{?/(if|foreach|capture|literal|php|section|strip|block|form)|(^|\s)\})</string>
<!--
<string>(&lt;/(?i:(head|table|tr|div|style|script|ul|ol|form|dl))&gt;|\{\{?/(if|foreach|capture|literal|foreach|php|section|strip|block)|(^|\s)\})</string>
-->
<!-- /------ -->
<key>name</key>
<string>Smarty</string>
<key>patterns</key>
<array>
<!-- /------Latte single macros -->
<dict>
<key>match</key>
<string>\b(control|widget|var|layout|extends)\b</string>
<key>name</key>
<string>keyword.operator.smarty</string>
</dict>
<!-- /------ -->
<!-- /------Latte pair macros -->
<dict>
<key>match</key>
<string>\b(if|else|elseif|foreach|foreachelse|section|block|form)\b</string>
<key>name</key>
<string>keyword.control.smarty</string>
</dict>
<!-- /------ -->
<dict>
<key>begin</key>
<string>(?&lt;=\{)\*</string>
<key>captures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.comment.smarty</string>
</dict>
</dict>
<key>end</key>
<string>\*(?=\})</string>
<key>name</key>
<string>comment.block.smarty</string>
</dict>
<dict>
<key>match</key>
<string>\b(capture|config_load|counter|cycle|debug|eval|fetch|include_php|include|insert|literal|math|strip|rdelim|ldelim|assign|html_[a-z_]*)\b</string>
<key>name</key>
<string>support.function.built-in.smarty</string>
</dict>
<dict>
<key>match</key>
<string>\b(and|or)\b</string>
<key>name</key>
<string>keyword.operator.smarty</string>
</dict>
<dict>
<key>match</key>
<string>\b(eq|neq|gt|lt|gte|lte|is|not|even|odd|not|mod|div|by)\b</string>
<key>name</key>
<string>keyword.operator.other.smarty</string>
</dict>
<dict>
<key>match</key>
<string>\|(capitalize|cat|count_characters|count_paragraphs|count_sentences|count_words|date_format|default|escape|indent|lower|nl2br|regex_replace|replace|spacify|string_format|strip_tags|strip|truncate|upper|wordwrap)</string>
<key>name</key>
<string>support.function.variable-modifier.smarty</string>
</dict>
<dict>
<key>match</key>
<string>\b[a-zA-Z]+=</string>
<key>name</key>
<string>meta.attribute.smarty</string>
</dict>
<dict>
<key>begin</key>
<string>'</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.begin.smarty</string>
</dict>
</dict>
<key>end</key>
<string>'</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.end.smarty</string>
</dict>
</dict>
<key>name</key>
<string>string.quoted.single.smarty</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>\\.</string>
<key>name</key>
<string>constant.character.escape.smarty</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>"</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.begin.smarty</string>
</dict>
</dict>
<key>end</key>
<string>"</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.end.smarty</string>
</dict>
</dict>
<key>name</key>
<string>string.quoted.double.smarty</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>\\.</string>
<key>name</key>
<string>constant.character.escape.smarty</string>
</dict>
</array>
</dict>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.variable.smarty</string>
</dict>
</dict>
<key>match</key>
<string>\b(\$)Smarty\.</string>
<key>name</key>
<string>variable.other.global.smarty</string>
</dict>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.variable.smarty</string>
</dict>
</dict>
<key>match</key>
<string>(\$)[a-zA-Z_\x{7f}-\x{ff}][a-zA-Z0-9_\x{7f}-\x{ff}]*?\b</string>
<key>name</key>
<string>variable.other.smarty</string>
</dict>
<dict>
<key>match</key>
<string>\b(TRUE|FALSE|true|false)\b</string>
<key>name</key>
<string>constant.language.smarty</string>
</dict>
</array>
<key>scopeName</key>
<string>source.smarty</string>
<key>uuid</key>
<string>4D6BBA54-E3FC-4296-9CA1-662B2AD537C6</string>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment