summaryrefslogtreecommitdiffstats
path: root/syntax
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2016-05-13 15:56:51 +0200
committerAdam Stankiewicz <sheerun@sher.pl>2016-05-13 16:10:17 +0200
commitb9dae8fbab5c49d5cb7d117de9a782217e6b0f60 (patch)
tree678c559c854a064e9ad5da2db1a76c8bea354055 /syntax
parent84593f2d7f25ba215a7bab954d639a2718f88c24 (diff)
downloadvim-polyglot-b9dae8fbab5c49d5cb7d117de9a782217e6b0f60.tar.gz
vim-polyglot-b9dae8fbab5c49d5cb7d117de9a782217e6b0f60.zip
Add mako support, closes #126
Diffstat (limited to 'syntax')
-rw-r--r--syntax/mako.vim96
1 files changed, 96 insertions, 0 deletions
diff --git a/syntax/mako.vim b/syntax/mako.vim
new file mode 100644
index 00000000..7a9eb654
--- /dev/null
+++ b/syntax/mako.vim
@@ -0,0 +1,96 @@
+if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'mako') == -1
+
+" Vim syntax file
+" Language: Mako
+" Maintainer: Armin Ronacher <armin.ronacher@active-4.com>
+" URL: http://lucumr.pocoo.org/
+" Last Change: 2013-05-01
+" Version: 0.6.1+
+"
+" Thanks to Brine Rue <brian@lolapps.com> who noticed a bug in the
+" delimiter handling.
+"
+" Known Limitations
+" the <%text> block does not have correct attributes
+
+" For version 5.x: Clear all syntax items
+" For version 6.x: Quit when a syntax file was already loaded
+if version < 600
+ syntax clear
+elseif exists("b:current_syntax")
+ finish
+endif
+
+if !exists("main_syntax")
+ let main_syntax = "html"
+endif
+
+"Source the html syntax file
+ru! syntax/html.vim
+unlet b:current_syntax
+
+" tell html.vim what syntax groups should take precedence (see :help html.vim)
+syn cluster htmlPreproc add=makoLine,makoVariable,makoTag,makoDocComment,makoDefEnd,makoText,makoDelim,makoEnd,makoComment,makoEscape
+
+"Put the python syntax file in @pythonTop
+syn include @pythonTop syntax/python.vim
+
+" End keywords
+syn keyword makoEnd contained endfor endwhile endif endtry enddef
+
+" Block rules
+syn region makoLine matchgroup=makoDelim start=#^\s*%# end=#$# keepend contains=@pythonTop,makoEnd
+syn region makoBlock matchgroup=makoDelim start=#<%!\?# end=#%># keepend contains=@pythonTop,makoEnd
+
+" Variables
+syn region makoNested start="{" end="}" transparent display contained contains=makoNested,@pythonTop
+syn region makoVariable matchgroup=makoDelim start=#\${# end=#}# contains=makoNested,@pythonTop
+
+" Comments
+syn region makoComment start="^\s*##" end="$"
+syn region makoDocComment matchgroup=makoDelim start="<%doc>" end="</%doc>" keepend
+
+" Literal Blocks
+syn region makoText matchgroup=makoDelim start="<%text[^>]*>" end="</%text>"
+
+" Attribute Sublexing
+syn match makoAttributeKey containedin=makoTag contained "[a-zA-Z_][a-zA-Z0-9_]*="
+syn region makoAttributeValue containedin=makoTag contained start=/"/ skip=/\\"/ end=/"/
+syn region makoAttributeValue containedin=MakoTag contained start=/'/ skip=/\\'/ end=/'/
+
+" Tags
+syn region makoTag matchgroup=makoDelim start="<%\(def\|call\|page\|include\|namespace\|inherit\|block\|[a-zA-Z_][a-zA-Z0-9_]*:[a-zA-Z_][a-zA-Z0-9_]*\)\>" end="/\?>"
+syn match makoDelim "</%\(def\|call\|namespace\|block\|[a-zA-Z_][a-zA-Z0-9_]*:[a-zA-Z_][a-zA-Z0-9_]*\)>"
+
+syn region makoJavaScript matchgroup=makoDelim start=+<%block .*js.*>+ keepend end=+</%block>+ contains=@htmlJavaScript,htmlCssStyleComment,htmlScriptTag,@htmlPreproc,makoLine,makoBlock,makoVariable
+syn region makoCssStyle matchgroup=makoDelim start=+<%block .*css.*>+ keepend end=+</%block>+ contains=@htmlCss,htmlTag,htmlEndTag,htmlCssStyleComment,@htmlPreproc,makoLine,makoBlock,makoVariable
+
+" Newline Escapes
+syn match makoEscape /\\$/
+
+" Default highlighting links
+if version >= 508 || !exists("did_mako_syn_inits")
+ if version < 508
+ let did_mako_syn_inits = 1
+ com -nargs=+ HiLink hi link <args>
+ else
+ com -nargs=+ HiLink hi def link <args>
+ endif
+
+ HiLink makoDocComment makoComment
+ HiLink makoDefEnd makoDelim
+
+ HiLink makoAttributeKey Type
+ HiLink makoAttributeValue String
+ HiLink makoText Normal
+ HiLink makoDelim Preproc
+ HiLink makoEnd Keyword
+ HiLink makoComment Comment
+ HiLink makoEscape Special
+
+ delc HiLink
+endif
+
+let b:current_syntax = "html"
+
+endif