Skip to content

Instantly share code, notes, and snippets.

@BlackFoks
Forked from unixmonkey/Haml.tmLanguage
Created July 18, 2012 05:22
Show Gist options
  • Save BlackFoks/3134369 to your computer and use it in GitHub Desktop.
Save BlackFoks/3134369 to your computer and use it in GitHub Desktop.
Haml Language definition file for TextMate; modified to work with Sublime Text 2
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
<string>haml</string>
<string>sass</string>
</array>
<key>foldingStartMarker</key>
<string>^\s*([-%#\:\.\w\=].*)\s$</string>
<key>foldingStopMarker</key>
<string>^\s*$</string>
<key>keyEquivalent</key>
<string>^~H</string>
<key>name</key>
<string>Haml</string>
<key>patterns</key>
<array>
<dict>
<key>begin</key>
<string>^( *):javascript</string>
<key>end</key>
<string>^(?!\1 )</string>
<key>name</key>
<string>js.haml</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>source.js.jquery</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>^\s*==</string>
<key>contentName</key>
<string>string.quoted.double.ruby</string>
<key>end</key>
<string>$\n?</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#interpolated_ruby</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>^(\s*):ruby$</string>
<key>end</key>
<string>^\1$</string>
<key>name</key>
<string>source.ruby.embedded.filter.haml</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>source.ruby.rails</string>
</dict>
</array>
</dict>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.prolog.haml</string>
</dict>
</dict>
<key>match</key>
<string>^(!!!)($|\s.*)</string>
<key>name</key>
<string>meta.prolog.haml</string>
</dict>
<dict>
<key>begin</key>
<string>:javascript</string>
<key>end</key>
<string>^(\s+)?%</string>
<key>name</key>
<string>source.js.embedded.haml</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>source.js</string>
</dict>
<dict>
<key>include</key>
<string>source.js.jquery</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>^(\s*):javascript$</string>
<key>end</key>
<string>^\1$</string>
<key>name</key>
<string>source.embedded.filter.js</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>source.js</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>^(\s*):ruby$</string>
<key>end</key>
<string>^\1$</string>
<key>name</key>
<string>source.ruby.embedded.filter.haml</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>source.ruby.rails</string>
</dict>
</array>
</dict>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.section.comment.haml</string>
</dict>
</dict>
<key>match</key>
<string>^ *(/)\s*\S.*$\n?</string>
<key>name</key>
<string>comment.line.slash.haml</string>
</dict>
<dict>
<key>begin</key>
<string>^( *)(/)\s*$</string>
<key>beginCaptures</key>
<dict>
<key>2</key>
<dict>
<key>name</key>
<string>punctuation.section.comment.haml</string>
</dict>
</dict>
<key>end</key>
<string>^(?!\1 )</string>
<key>name</key>
<string>comment.block.haml</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>text.haml</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>^\s*(?:((%)([\w:]+))|(?=\.|#))</string>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>meta.tag.haml</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>punctuation.definition.tag.haml</string>
</dict>
<key>3</key>
<dict>
<key>name</key>
<string>entity.name.tag.haml</string>
</dict>
</dict>
<key>end</key>
<string>$|(?!\.|#|\{|\[|=|-|~|/)</string>
<key>patterns</key>
<array>
<dict>
<key>begin</key>
<string>==</string>
<key>contentName</key>
<string>string.quoted.double.ruby</string>
<key>end</key>
<string>$\n?</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#interpolated_ruby</string>
</dict>
</array>
</dict>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>entity.other.attribute-name.class</string>
</dict>
</dict>
<key>match</key>
<string>(\.[\w-]+)</string>
<key>name</key>
<string>meta.selector.css</string>
</dict>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>entity.other.attribute-name.id</string>
</dict>
</dict>
<key>match</key>
<string>(#[\w-]+)</string>
<key>name</key>
<string>meta.selector.css</string>
</dict>
<dict>
<key>begin</key>
<string>\{(?=.*\}||.*\|\s*$)</string>
<key>end</key>
<string>\}|$|^(?!.*\|\s*$)</string>
<key>name</key>
<string>meta.section.attributes.haml</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>source.ruby.rails</string>
</dict>
<dict>
<key>include</key>
<string>#continuation</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>\[(?=.*\]|.*\|\s*$)</string>
<key>end</key>
<string>\]|$|^(?!.*\|\s*$)</string>
<key>name</key>
<string>meta.section.object.haml</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>source.ruby.rails</string>
</dict>
<dict>
<key>include</key>
<string>#continuation</string>
</dict>
</array>
</dict>
<dict>
<key>include</key>
<string>#interpolated_ruby_line</string>
</dict>
<dict>
<key>include</key>
<string>#rubyline</string>
</dict>
<dict>
<key>match</key>
<string>/</string>
<key>name</key>
<string>punctuation.terminator.tag.haml</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>^(\s*):ruby$</string>
<key>end</key>
<string>^\1$</string>
<key>name</key>
<string>source.ruby.embedded.filter.haml</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>source.ruby.rails</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>^(\s*):ruby$</string>
<key>end</key>
<string>^\1([^\s]*)$</string>
<key>name</key>
<string>source.ruby.embedded.filter.haml</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>source.ruby.rails</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>^(\s*):(style|sass)$</string>
<key>end</key>
<string>^\1$</string>
<key>name</key>
<string>source.sass.embedded.filter.haml</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>source.sass</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>^(\s*):(java)?script$</string>
<key>end</key>
<string>^\1([^\s]*)$</string>
<key>name</key>
<string>source.js.embedded.filter.haml</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#javascript_filter</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>^(\s*):plain$</string>
<key>end</key>
<string>^\1([^\s]*)$</string>
<key>name</key>
<string>text.plain.embedded.filter.haml</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>text.plain</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>^(\s*)(:ruby)</string>
<key>beginCaptures</key>
<dict>
<key>2</key>
<dict>
<key>name</key>
<string>keyword.control.filter.haml</string>
</dict>
</dict>
<key>end</key>
<string>^(?!\1 )</string>
<key>name</key>
<string>source.ruby.embedded.filter.haml</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>source.ruby.rails</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>^(\s*)(:javascript)</string>
<key>beginCaptures</key>
<dict>
<key>2</key>
<dict>
<key>name</key>
<string>keyword.control.filter.haml</string>
</dict>
</dict>
<key>end</key>
<string>^(?!\1 )</string>
<key>name</key>
<string>source.js.jquery.embedded.filter.haml</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>source.js.jquery</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>^(\s*)(:sass)</string>
<key>beginCaptures</key>
<dict>
<key>2</key>
<dict>
<key>name</key>
<string>keyword.control.filter.haml</string>
</dict>
</dict>
<key>end</key>
<string>^(?!\1 )</string>
<key>name</key>
<string>source.embedded.filter.sass</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>source.sass</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>^(\s*):(styles|sass)$</string>
<key>end</key>
<string>^\1$</string>
<key>name</key>
<string>source.sass.embedded.filter.haml</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>source.sass</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>^(\s*):(java)?script$</string>
<key>end</key>
<string>^\1$</string>
<key>name</key>
<string>source.js.embedded.filter.haml</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>source.js</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>^(\s*):plain$</string>
<key>end</key>
<string>^\1$</string>
<key>name</key>
<string>text.plain.embedded.filter.haml</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>text.plain</string>
</dict>
</array>
</dict>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>meta.escape.haml</string>
</dict>
</dict>
<key>match</key>
<string>^\s*(\\.)</string>
</dict>
<dict>
<key>begin</key>
<string>^\s*(?==|-|~)</string>
<key>end</key>
<string>$</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#interpolated_ruby_line</string>
</dict>
<dict>
<key>include</key>
<string>#rubyline</string>
</dict>
</array>
</dict>
</array>
<key>repository</key>
<dict>
<key>continuation</key>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.separator.continuation.haml</string>
</dict>
</dict>
<key>match</key>
<string>(\|)\s*\n</string>
</dict>
<key>interpolated_ruby</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>captures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.section.embedded.ruby</string>
</dict>
<key>1</key>
<dict>
<key>name</key>
<string>source.ruby.embedded.source.empty</string>
</dict>
</dict>
<key>match</key>
<string>#\{(\})</string>
<key>name</key>
<string>source.ruby.embedded.source</string>
</dict>
<dict>
<key>begin</key>
<string>#\{</string>
<key>captures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.section.embedded.ruby</string>
</dict>
</dict>
<key>end</key>
<string>(\})</string>
<key>name</key>
<string>source.ruby.embedded.source</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#nest_curly_and_self</string>
</dict>
<dict>
<key>include</key>
<string>source.ruby</string>
</dict>
</array>
</dict>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.variable.ruby</string>
</dict>
</dict>
<key>match</key>
<string>(#@)[a-zA-Z_]\w*</string>
<key>name</key>
<string>variable.other.readwrite.instance.ruby</string>
</dict>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.variable.ruby</string>
</dict>
</dict>
<key>match</key>
<string>(#@@)[a-zA-Z_]\w*</string>
<key>name</key>
<string>variable.other.readwrite.class.ruby</string>
</dict>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.variable.ruby</string>
</dict>
</dict>
<key>match</key>
<string>(#\$)[a-zA-Z_]\w*</string>
<key>name</key>
<string>variable.other.readwrite.global.ruby</string>
</dict>
</array>
</dict>
<key>interpolated_ruby_line</key>
<dict>
<key>begin</key>
<string>!?==</string>
<key>end</key>
<string>$</string>
<key>name</key>
<string>meta.line.ruby.interpolated.haml</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#interpolated_ruby</string>
</dict>
</array>
</dict>
<key>javascript_filter</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#interpolated_ruby</string>
</dict>
<dict>
<key>include</key>
<string>source.js</string>
</dict>
</array>
</dict>
<key>nest_curly_and_self</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>begin</key>
<string>\{</string>
<key>captures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.section.scope.ruby</string>
</dict>
</dict>
<key>end</key>
<string>\}</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#nest_curly_and_self</string>
</dict>
</array>
</dict>
<dict>
<key>include</key>
<string>source.ruby</string>
</dict>
</array>
</dict>
<key>rubyline</key>
<dict>
<key>begin</key>
<string>=|-|~</string>
<key>contentName</key>
<string>source.ruby.embedded.haml</string>
<key>end</key>
<string>((do|\{)( \|[^|]+\|)?)$|$|^(?!.*\|\s*$)</string>
<key>endCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>source.ruby.embedded.html</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>keyword.control.ruby.start-block</string>
</dict>
</dict>
<key>name</key>
<string>meta.line.ruby.haml</string>
<key>patterns</key>
<array>
<dict>
<key>comment</key>
<string>Hack to let ruby comments work in this context properly</string>
<key>match</key>
<string>#.*$</string>
<key>name</key>
<string>comment.line.number-sign.ruby</string>
</dict>
<dict>
<key>include</key>
<string>source.ruby.rails</string>
</dict>
<dict>
<key>include</key>
<string>#continuation</string>
</dict>
</array>
</dict>
</dict>
<key>scopeName</key>
<string>text.haml</string>
<key>uuid</key>
<string>3D727049-DD05-45DF-92A5-D50EA36FD035</string>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment