3 " Maintainer: Juvenn Woo <machese@gmail.com>
4 " Screenshot: http://imgur.com/6F408
6 " Last Change: 2009 Oct 15
8 " It lexically hilights embedded mustaches (exclusively) in html file.
9 " While it was written for Ruby-based Mustache template system, it should work for Google's C-based *ctemplate* as well as Erlang-based *et*. All of them are, AFAIK, based on the idea of ctemplate.
11 " [Mustache](http://github.com/defunkt/mustache)
12 " [ctemplate](http://code.google.com/p/google-ctemplate/)
13 " [ctemplate doc](http://google-ctemplate.googlecode.com/svn/trunk/doc/howto.html)
14 " [et](http://www.ivan.fomichev.name/2008/05/erlang-template-engine-prototype.html)
15 " TODO: Feedback is welcomed.
18 " Read the HTML syntax to start with
20 so <sfile>:p:h/html.vim
22 runtime! syntax/html.vim
23 unlet b:current_syntax
28 elseif exists("b:current_syntax")
32 " Standard HiLink will not work with included syntax files
34 command! -nargs=+ HtmlHiLink hi link <args>
36 command! -nargs=+ HtmlHiLink hi def link <args>
39 syntax match mustacheError '}}}\?'
40 syntax match mustacheInsideError '{{[{#^<>=!\/]\?' containedin=@mustacheInside
41 syntax region mustacheVariable matchgroup=mustacheMarker start=/{{/ end=/}}/ containedin=@htmlMustacheContainer
42 syntax region mustacheVariableUnescape matchgroup=mustacheMarker start=/{{{/ end=/}}}/ containedin=@htmlMustacheContainer
43 syntax region mustacheSection matchgroup=mustacheMarker start='{{[#^/]' end=/}}/ containedin=@htmlMustacheContainer
44 syntax region mustachePartial matchgroup=mustacheMarker start=/{{[<>]/ end=/}}/
45 syntax region mustacheMarkerSet matchgroup=mustacheMarker start=/{{=/ end=/=}}/
46 syntax region mustacheComment start=/{{!/ end=/}}/ contains=Todo containedin=htmlHead
50 syntax cluster mustacheInside add=mustacheVariable,mustacheVariableUnescape,mustacheSection,mustachePartial,mustacheMarkerSet
51 syntax cluster htmlMustacheContainer add=htmlHead,htmlTitle,htmlString,htmlH1,htmlH2,htmlH3,htmlH4,htmlH5,htmlH6
55 " mustacheInside hilighted as Number, which is rarely used in html
56 " you might like change it to Function or Identifier
57 HtmlHiLink mustacheVariable Number
58 HtmlHiLink mustacheVariableUnescape Number
59 HtmlHiLink mustachePartial Number
60 HtmlHiLink mustacheSection Number
61 HtmlHiLink mustacheMarkerSet Number
63 HtmlHiLink mustacheComment Comment
64 HtmlHiLink mustacheMarker Identifier
65 HtmlHiLink mustacheError Error
66 HtmlHiLink mustacheInsideError Error
68 let b:current_syntax = "mustache"