Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

django template hilighting

  • Loading branch information...
commit 08b66acc26e21a7ff5ab9bef43ef8e7c906d63e6 1 parent 6e55087
@mattly authored
Showing with 36 additions and 2 deletions.
  1. +2 −2 vim/syntax/django.vim
  2. +34 −0 vim/syntax/htmldjango.vim
View
4 vim/syntax/django.vim
@@ -21,7 +21,7 @@ syn match djangoError "%}\|}}\|#}"
syn keyword djangoStatement contained autoescape csrf_token empty
" FIXME ==, !=, <, >, <=, and >= should be djangoStatements:
" syn keyword djangoStatement contained == != < > <= >=
-syn keyword djangoStatement contained and as block endblock by cycle debug else
+syn keyword djangoStatement contained and as block endblock by cycle debug else elif
syn keyword djangoStatement contained extends filter endfilter firstof for
syn keyword djangoStatement contained endfor if endif ifchanged endifchanged
syn keyword djangoStatement contained ifequal endifequal ifnotequal
@@ -45,7 +45,7 @@ syn keyword djangoFilter contained linebreaks linebreaksbr linenumbers ljust
syn keyword djangoFilter contained lower make_list phone2numeric pluralize
syn keyword djangoFilter contained pprint random removetags rjust slice slugify
syn keyword djangoFilter contained safe safeseq stringformat striptags
-syn keyword djangoFilter contained time timesince timeuntil title
+syn keyword djangoFilter contained time timesince timeuntil title truncatechars
syn keyword djangoFilter contained truncatewords truncatewords_html unordered_list upper urlencode
syn keyword djangoFilter contained urlize urlizetrunc wordcount wordwrap yesno
View
34 vim/syntax/htmldjango.vim
@@ -0,0 +1,34 @@
+" Vim syntax file
+" Language: Django HTML template
+" Maintainer: Dave Hodder <dmh@dmh.org.uk>
+" Last Change: 2007 Jan 26
+
+" 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
+
+if version < 600
+ so <sfile>:p:h/django.vim
+ so <sfile>:p:h/html.vim
+else
+ runtime! syntax/django.vim
+ runtime! syntax/html.vim
+ unlet b:current_syntax
+endif
+
+syn cluster djangoBlocks add=djangoTagBlock,djangoVarBlock,djangoComment,djangoComBlock
+
+syn region djangoTagBlock start="{%" end="%}" contains=djangoStatement,djangoFilter,djangoArgument,djangoTagError display containedin=ALLBUT,@djangoBlocks
+syn region djangoVarBlock start="{{" end="}}" contains=djangoFilter,djangoArgument,djangoVarError display containedin=ALLBUT,@djangoBlocks
+syn region djangoComment start="{%\s*comment\s*%}" end="{%\s*endcomment\s*%}" contains=djangoTodo containedin=ALLBUT,@djangoBlocks
+syn region djangoComBlock start="{#" end="#}" contains=djangoTodo containedin=ALLBUT,@djangoBlocks
+
+let b:current_syntax = "htmldjango"
Please sign in to comment.
Something went wrong with that request. Please try again.