2
2
" Language: Mustache, Handlebars
3
3
" Maintainer: Juvenn Woo <[email protected] >
4
4
" Screenshot: http://imgur.com/6F408
5
- " Version: 5
6
- " Last Change: Nov 23rd 2018
5
+ " Version: 6
6
+ " Last Change: Jul 16 2019
7
7
" Remark:
8
8
" It lexically hilights embedded mustaches (exclusively) in html file.
9
9
" While it was written for Ruby-based Mustache template system, it should
@@ -41,21 +41,34 @@ endif
41
41
42
42
syntax match mustacheError ' }}}\? '
43
43
syntax match mustacheInsideError ' {{[{$#<>=!\/ ]\? '
44
- syntax region mustacheInside start =/ {{[^!][$#^/]\? / end =/ }}}\? / keepend containedin =TOP,@htmlMustacheContainer
45
- syntax match mustacheOperators ' =\|\.\| /' contained containedin =mustacheInside,mustacheParam
46
- syntax region mustacheHtmlValue start =/ ={{[^!][$#^/]\? / rs =s + 1 ,hs =s + 1 end =/ }}/ oneline keepend contained containedin =htmlTag contains =mustacheInside
47
- syntax region mustachePartial start =/ {{[<>]/ lc =2 end =/ }}/ me =e - 2 contained containedin =mustacheInside,@htmlMustacheContainer
48
- syntax region mustacheMarkerSet start =/ {{=/ lc =2 end =/ =}}/ me =e - 2 contained containedin =mustacheInside,@htmlMustacheContainer
49
- syntax match mustacheHandlebars ' {{\| }}' contained containedin =mustacheInside,@htmlMustacheContainer
50
- syntax match mustacheUnescape ' {{{\| }}}' contained containedin =mustacheInside,@htmlMustacheContainer
51
- syntax match mustacheConditionals ' \( [/#]\? if\| unless\| else\) ' contained containedin =mustacheInside
52
- syntax match mustacheHelpers ' [/#]\?\( with\| link\- to\| each\(\- in\)\?\) ' contained containedin =mustacheInside
53
- syntax match mustacheHelpers ' else \( if\| unless\| with\| link\- to\| each\(\- in\)\?\) ' contained containedin =mustacheInside
54
- syntax match mustacheParam / [a-z@_-]\+ =/ he =e - 1 contained containedin =mustacheInside
55
- syntax region mustacheComment start =/ {{!/ rs =s + 2 skip =/ {{.\{ -}}}/ end =/ }}/ re =e - 2 contains =Todo contained containedin =TOP,mustacheInside,@htmlMustacheContainer
56
- syntax region mustacheBlockComment start =/ {{!--/ rs =s + 2 skip =/ {{.\{ -}}}/ end =/ --}}/ re =e - 2 contains =Todo contained extend containedin =TOP,mustacheInside,@htmlMustacheContainer
57
- syntax region mustacheQString start =/ '/ skip =/ \\ '/ end =/ '/ contained containedin =mustacheInside
58
- syntax region mustacheDQString start =/ "/ skip =/ \\ "/ end =/ "/ contained containedin =mustacheInside
44
+
45
+ " Ember angle bracket syntax syntax starts with a capital letter:
46
+ " https://github.com/emberjs/rfcs/blob/master/text/0311-angle-bracket-invocation.md
47
+ syntax case match
48
+ syntax region mustacheAngleComponent start =/ <\/\? [[:upper:]]/ end =/ >/ keepend containedin =TOP,@htmlMustacheContainer
49
+ syntax case ignore
50
+ syntax match mustacheAngleBrackets ' </\?\| /\? >' contained containedin =mustacheAngleComponent
51
+ syntax match mustacheAngleComponentName ' </[[:alnum:]]\+ ' hs =s + 2 contained containedin =mustacheAngleBrackets
52
+ syntax match mustacheAngleComponentName ' <[[:alnum:]]\+ ' hs =s + 1 contained containedin =mustacheAngleBrackets
53
+
54
+ syntax region mustacheHbsComponent start =/ {{[^!][$#^/]\? / end =/ }}}\? / keepend containedin =TOP,@htmlMustacheContainer
55
+
56
+ syntax cluster mustacheInside add =mustacheHbsComponent,mustacheAngleComponent
57
+
58
+ syntax match mustacheOperators ' =\|\.\| /^>' contained containedin =@mustacheInside,mustacheParam
59
+ syntax region mustacheHtmlValue start =/ ={{[^!][$#^/]\? / rs =s + 1 ,hs =s + 1 end =/ }}/ oneline keepend contained containedin =htmlTag contains =@mustacheInside
60
+ syntax region mustachePartial start =/ {{[<>]/ lc =2 end =/ }}/ me =e - 2 contained containedin =@mustacheInside,@htmlMustacheContainer
61
+ syntax region mustacheMarkerSet start =/ {{=/ lc =2 end =/ =}}/ me =e - 2 contained containedin =@mustacheInside,@htmlMustacheContainer
62
+ syntax match mustacheHandlebars ' {{\| }}' contained containedin =@mustacheInside
63
+ syntax match mustacheUnescape ' {{{\| }}}' contained containedin =@mustacheInside
64
+ syntax match mustacheConditionals ' \( [/#]\? if\| unless\| else\) ' contained containedin =@mustacheInside
65
+ syntax match mustacheHelpers ' [/#]\?\( with\| link\- to\| each\(\- in\)\?\) ' contained containedin =@mustacheInside
66
+ syntax match mustacheHelpers ' else \( if\| unless\| with\| link\- to\| each\(\- in\)\?\) ' contained containedin =@mustacheInside
67
+ syntax match mustacheParam / [a-z@_-]\+ =/ he =e - 1 contained containedin =@mustacheInside
68
+ syntax region mustacheComment start =/ {{!/ rs =s + 2 skip =/ {{.\{ -}}}/ end =/ }}/ re =e - 2 contains =Todo contained containedin =TOP,@mustacheInside,@htmlMustacheContainer
69
+ syntax region mustacheBlockComment start =/ {{!--/ rs =s + 2 skip =/ {{.\{ -}}}/ end =/ --}}/ re =e - 2 contains =Todo contained extend containedin =TOP,@mustacheInside,@htmlMustacheContainer
70
+ syntax region mustacheQString start =/ '/ skip =/ \\ '/ end =/ '/ contained containedin =@mustacheInside
71
+ syntax region mustacheDQString start =/ "/ skip =/ \\ "/ end =/ "/ contained containedin =@mustacheInside
59
72
60
73
" Clustering
61
74
syntax cluster htmlMustacheContainer add =htmlHead,htmlTitle,htmlString,htmlH1,htmlH2,htmlH3,htmlH4,htmlH5,htmlH6,htmlLink,htmlBold,htmlUnderline,htmlItalic,htmlValue
@@ -69,13 +82,15 @@ HtmlHiLink mustacheVariableUnescape Number
69
82
HtmlHiLink mustachePartial Number
70
83
HtmlHiLink mustacheMarkerSet Number
71
84
HtmlHiLink mustacheParam htmlArg
85
+ HtmlHiLink mustacheAngleComponentName htmlTag
72
86
73
87
HtmlHiLink mustacheComment Comment
74
88
HtmlHiLink mustacheBlockComment Comment
75
89
HtmlHiLink mustacheError Error
76
90
HtmlHiLink mustacheInsideError Error
77
91
78
92
HtmlHiLink mustacheHandlebars Special
93
+ HtmlHiLink mustacheAngleBrackets htmlTagName
79
94
HtmlHiLink mustacheUnescape Identifier
80
95
HtmlHiLink mustacheOperators Operator
81
96
HtmlHiLink mustacheConditionals Conditional
0 commit comments