1
0
Fork 0
mirror of https://github.com/vim/vim synced 2025-03-16 14:57:52 +01:00
vim/runtime/syntax/haml.vim

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

110 lines
6.9 KiB
VimL
Raw Normal View History

2008-07-13 17:41:49 +00:00
" Vim syntax file
2010-07-26 22:21:27 +02:00
" Language: Haml
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Filenames: *.haml
2019-12-05 22:47:25 +01:00
" Last Change: 2019 Dec 05
2008-07-13 17:41:49 +00:00
if exists("b:current_syntax")
finish
endif
if !exists("main_syntax")
let main_syntax = 'haml'
endif
let b:ruby_no_expensive = 1
runtime! syntax/html.vim
unlet! b:current_syntax
silent! syn include @hamlSassTop syntax/sass.vim
unlet! b:current_syntax
syn include @hamlRubyTop syntax/ruby.vim
syn case match
2010-08-09 20:13:35 +02:00
syn region rubyCurlyBlock start="{" end="}" contains=@hamlRubyTop contained
2010-05-21 12:05:36 +02:00
syn cluster hamlRubyTop add=rubyCurlyBlock
syn cluster hamlComponent contains=hamlAttributes,hamlAttributesHash,hamlClassChar,hamlIdChar,hamlObject,hamlDespacer,hamlSelfCloser,hamlRuby,hamlPlainChar,hamlInterpolatable
syn cluster hamlEmbeddedRuby contains=hamlAttributesHash,hamlObject,hamlRuby,hamlRubyFilter
2008-07-13 17:41:49 +00:00
syn cluster hamlTop contains=hamlBegin,hamlPlainFilter,hamlRubyFilter,hamlSassFilter,hamlComment,hamlHtmlComment
2010-05-21 12:05:36 +02:00
syn match hamlBegin "^\s*\%([<>]\|&[^=~ ]\)\@!" nextgroup=hamlTag,hamlClassChar,hamlIdChar,hamlRuby,hamlPlainChar,hamlInterpolatable
2008-07-13 17:41:49 +00:00
2010-07-26 22:21:27 +02:00
syn match hamlTag "%\w\+\%(:\w\+\)\=" contained contains=htmlTagName,htmlSpecialTagName nextgroup=@hamlComponent
2010-05-21 12:05:36 +02:00
syn region hamlAttributes matchgroup=hamlAttributesDelimiter start="(" end=")" contained contains=htmlArg,hamlAttributeString,hamlAttributeVariable,htmlEvent,htmlCssDefinition nextgroup=@hamlComponent
syn region hamlAttributesHash matchgroup=hamlAttributesDelimiter start="{" end="}" contained contains=@hamlRubyTop nextgroup=@hamlComponent
syn region hamlObject matchgroup=hamlObjectDelimiter start="\[" end="\]" contained contains=@hamlRubyTop nextgroup=@hamlComponent
2008-07-13 17:41:49 +00:00
syn match hamlDespacer "[<>]" contained nextgroup=hamlDespacer,hamlSelfCloser,hamlRuby,hamlPlainChar,hamlInterpolatable
syn match hamlSelfCloser "/" contained
syn match hamlClassChar "\." contained nextgroup=hamlClass
2010-05-21 12:05:36 +02:00
syn match hamlIdChar "#{\@!" contained nextgroup=hamlId
2019-12-05 22:47:25 +01:00
syn match hamlClass "\%(\w\|-\|\:\)\+" contained nextgroup=@hamlComponent
2008-07-13 17:41:49 +00:00
syn match hamlId "\%(\w\|-\)\+" contained nextgroup=@hamlComponent
syn region hamlDocType start="^\s*!!!" end="$"
2010-05-21 12:05:36 +02:00
syn region hamlRuby matchgroup=hamlRubyOutputChar start="[!&]\==\|\~" skip=",\s*$" end="$" contained contains=@hamlRubyTop keepend
syn region hamlRuby matchgroup=hamlRubyChar start="-" skip=",\s*$" end="$" contained contains=@hamlRubyTop keepend
2008-07-13 17:41:49 +00:00
syn match hamlPlainChar "\\" contained
2010-05-21 12:05:36 +02:00
syn region hamlInterpolatable matchgroup=hamlInterpolatableChar start="!\===\|!=\@!" end="$" keepend contained contains=hamlInterpolation,hamlInterpolationEscape,@hamlHtmlTop
syn region hamlInterpolatable matchgroup=hamlInterpolatableChar start="&==\|&=\@!" end="$" keepend contained contains=hamlInterpolation,hamlInterpolationEscape
2010-08-09 20:13:35 +02:00
syn region hamlInterpolation matchgroup=hamlInterpolationDelimiter start="#{" end="}" contains=@hamlRubyTop containedin=javascriptStringS,javascriptStringD
2010-05-21 12:05:36 +02:00
syn match hamlInterpolationEscape "\\\@<!\%(\\\\\)*\\\%(\\\ze#{\|#\ze{\)"
2008-08-09 17:55:22 +00:00
syn region hamlErbInterpolation matchgroup=hamlInterpolationDelimiter start="<%[=-]\=" end="-\=%>" contained contains=@hamlRubyTop
2008-07-13 17:41:49 +00:00
2010-05-21 12:05:36 +02:00
syn region hamlAttributeString start=+\%(=\s*\)\@<='+ skip=+\%(\\\\\)*\\'+ end=+'+ contains=hamlInterpolation,hamlInterpolationEscape
syn region hamlAttributeString start=+\%(=\s*\)\@<="+ skip=+\%(\\\\\)*\\"+ end=+"+ contains=hamlInterpolation,hamlInterpolationEscape
syn match hamlAttributeVariable "\%(=\s*\)\@<=\%(@@\=\|\$\)\=\w\+" contained
2010-08-09 20:13:35 +02:00
syn match hamlHelper "\<action_view?\|\<block_is_haml?\|\<is_haml?\|\.\@<!\<flatten" contained containedin=@hamlEmbeddedRuby,@hamlRubyTop
syn keyword hamlHelper capture_haml escape_once find_and_preserve haml_concat haml_indent haml_tag html_attrs html_esape init_haml_helpers list_of non_haml precede preserve succeed surround tab_down tab_up page_class contained containedin=@hamlEmbeddedRuby,@hamlRubyTop
2008-07-13 17:41:49 +00:00
2008-08-09 17:55:22 +00:00
syn cluster hamlHtmlTop contains=@htmlTop,htmlBold,htmlItalic,htmlUnderline
2010-08-09 20:13:35 +02:00
syn region hamlPlainFilter matchgroup=hamlFilter start="^\z(\s*\):\%(plain\|preserve\|redcloth\|textile\|markdown\|maruku\)\s*$" end="^\%(\z1 \| *$\)\@!" contains=@hamlHtmlTop,hamlInterpolation
syn region hamlEscapedFilter matchgroup=hamlFilter start="^\z(\s*\):\%(escaped\|cdata\)\s*$" end="^\%(\z1 \| *$\)\@!" contains=hamlInterpolation
2010-05-21 12:05:36 +02:00
syn region hamlErbFilter matchgroup=hamlFilter start="^\z(\s*\):erb\s*$" end="^\%(\z1 \| *$\)\@!" contains=@hamlHtmlTop,hamlErbInterpolation
syn region hamlRubyFilter matchgroup=hamlFilter start="^\z(\s*\):ruby\s*$" end="^\%(\z1 \| *$\)\@!" contains=@hamlRubyTop
2010-08-09 20:13:35 +02:00
syn region hamlJavascriptFilter matchgroup=hamlFilter start="^\z(\s*\):javascript\s*$" end="^\%(\z1 \| *$\)\@!" contains=@htmlJavaScript,hamlInterpolation keepend
syn region hamlCSSFilter matchgroup=hamlFilter start="^\z(\s*\):css\s*$" end="^\%(\z1 \| *$\)\@!" contains=@htmlCss,hamlInterpolation keepend
2010-05-21 12:05:36 +02:00
syn region hamlSassFilter matchgroup=hamlFilter start="^\z(\s*\):sass\s*$" end="^\%(\z1 \| *$\)\@!" contains=@hamlSassTop
syn region hamlJavascriptBlock start="^\z(\s*\)%script\%((type=[\"']text/javascript[\"'])\)\=\s*$" nextgroup=@hamlComponent,hamlError end="^\%(\z1 \| *$\)\@!" contains=@hamlTop,@htmlJavaScript keepend
2010-05-21 12:05:36 +02:00
syn region hamlCssBlock start="^\z(\s*\)%style" nextgroup=@hamlComponent,hamlError end="^\%(\z1 \| *$\)\@!" contains=@hamlTop,@htmlCss keepend
2008-07-13 17:41:49 +00:00
syn match hamlError "\$" contained
2010-05-21 12:05:36 +02:00
syn region hamlComment start="^\z(\s*\)-#" end="^\%(\z1 \| *$\)\@!" contains=rubyTodo
syn region hamlHtmlComment start="^\z(\s*\)/" end="^\%(\z1 \| *$\)\@!" contains=@hamlTop,rubyTodo
2008-07-13 17:41:49 +00:00
syn match hamlIEConditional "\%(^\s*/\)\@<=\[if\>[^]]*]" contained containedin=hamlHtmlComment
hi def link hamlSelfCloser Special
hi def link hamlDespacer Special
hi def link hamlClassChar Special
hi def link hamlIdChar Special
hi def link hamlTag Special
hi def link hamlClass Type
hi def link hamlId Identifier
hi def link hamlPlainChar Special
hi def link hamlInterpolatableChar hamlRubyChar
hi def link hamlRubyOutputChar hamlRubyChar
hi def link hamlRubyChar Special
hi def link hamlInterpolationDelimiter Delimiter
2010-05-21 12:05:36 +02:00
hi def link hamlInterpolationEscape Special
hi def link hamlAttributeString String
hi def link hamlAttributeVariable Identifier
2008-07-13 17:41:49 +00:00
hi def link hamlDocType PreProc
hi def link hamlFilter PreProc
hi def link hamlAttributesDelimiter Delimiter
hi def link hamlObjectDelimiter Delimiter
hi def link hamlHelper Function
hi def link hamlHtmlComment hamlComment
hi def link hamlComment Comment
hi def link hamlIEConditional SpecialComment
hi def link hamlError Error
let b:current_syntax = "haml"
2010-05-21 12:05:36 +02:00
if main_syntax == "haml"
unlet main_syntax
endif
2008-07-13 17:41:49 +00:00
" vim:set sw=2: