| 
									
										
										
										
											2006-03-23 22:59:57 +00:00
										 |  |  | " Vim syntax file | 
					
						
							|  |  |  | " Language:	Django template | 
					
						
							|  |  |  | " Maintainer:	Dave Hodder <dmh@dmh.org.uk> | 
					
						
							| 
									
										
										
										
											2021-12-05 21:54:04 +00:00
										 |  |  | " Last Change:	2021 Nov 29 | 
					
						
							| 
									
										
										
										
											2006-03-23 22:59:57 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-30 23:26:57 +02:00
										 |  |  | " quit when a syntax file was already loaded | 
					
						
							|  |  |  | if exists("b:current_syntax") | 
					
						
							| 
									
										
										
										
											2006-03-23 22:59:57 +00:00
										 |  |  |   finish | 
					
						
							|  |  |  | endif | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | syntax case match | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-05-05 17:59:48 +00:00
										 |  |  | " Mark illegal characters | 
					
						
							|  |  |  | syn match djangoError "%}\|}}\|#}" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-03-23 22:59:57 +00:00
										 |  |  | " Django template built-in tags and parameters | 
					
						
							|  |  |  | " 'comment' doesn't appear here because it gets special treatment | 
					
						
							| 
									
										
										
										
											2010-05-20 21:46:00 +02:00
										 |  |  | syn keyword djangoStatement contained autoescape csrf_token empty | 
					
						
							|  |  |  | " FIXME ==, !=, <, >, <=, and >= should be djangoStatements: | 
					
						
							|  |  |  | " syn keyword djangoStatement contained == != < > <= >= | 
					
						
							| 
									
										
										
										
											2012-04-13 23:04:47 +02:00
										 |  |  | syn keyword djangoStatement contained and as block endblock by cycle debug else elif | 
					
						
							| 
									
										
										
										
											2010-05-20 21:46:00 +02:00
										 |  |  | syn keyword djangoStatement contained extends filter endfilter firstof for | 
					
						
							| 
									
										
										
										
											2006-03-23 22:59:57 +00:00
										 |  |  | syn keyword djangoStatement contained endfor if endif ifchanged endifchanged | 
					
						
							|  |  |  | syn keyword djangoStatement contained ifequal endifequal ifnotequal | 
					
						
							|  |  |  | syn keyword djangoStatement contained endifnotequal in include load not now or | 
					
						
							|  |  |  | syn keyword djangoStatement contained parsed regroup reversed spaceless | 
					
						
							|  |  |  | syn keyword djangoStatement contained endspaceless ssi templatetag openblock | 
					
						
							|  |  |  | syn keyword djangoStatement contained closeblock openvariable closevariable | 
					
						
							| 
									
										
										
										
											2007-05-05 17:59:48 +00:00
										 |  |  | syn keyword djangoStatement contained openbrace closebrace opencomment | 
					
						
							| 
									
										
										
										
											2007-05-10 18:29:51 +00:00
										 |  |  | syn keyword djangoStatement contained closecomment widthratio url with endwith | 
					
						
							| 
									
										
										
										
											2007-05-05 17:59:48 +00:00
										 |  |  | syn keyword djangoStatement contained get_current_language trans noop blocktrans | 
					
						
							|  |  |  | syn keyword djangoStatement contained endblocktrans get_available_languages | 
					
						
							|  |  |  | syn keyword djangoStatement contained get_current_language_bidi plural | 
					
						
							| 
									
										
										
										
											2021-12-05 21:54:04 +00:00
										 |  |  | syn keyword djangoStatement contained translate blocktranslate endblocktranslate | 
					
						
							| 
									
										
										
										
											2006-03-23 22:59:57 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | " Django templete built-in filters | 
					
						
							|  |  |  | syn keyword djangoFilter contained add addslashes capfirst center cut date | 
					
						
							|  |  |  | syn keyword djangoFilter contained default default_if_none dictsort | 
					
						
							| 
									
										
										
										
											2010-01-06 20:54:52 +01:00
										 |  |  | syn keyword djangoFilter contained dictsortreversed divisibleby escape escapejs | 
					
						
							| 
									
										
										
										
											2006-03-23 22:59:57 +00:00
										 |  |  | syn keyword djangoFilter contained filesizeformat first fix_ampersands | 
					
						
							| 
									
										
										
										
											2010-05-20 21:46:00 +02:00
										 |  |  | syn keyword djangoFilter contained floatformat get_digit join last length length_is | 
					
						
							| 
									
										
										
										
											2006-03-23 22:59:57 +00:00
										 |  |  | syn keyword djangoFilter contained linebreaks linebreaksbr linenumbers ljust | 
					
						
							|  |  |  | syn keyword djangoFilter contained lower make_list phone2numeric pluralize | 
					
						
							| 
									
										
										
										
											2010-05-20 21:46:00 +02:00
										 |  |  | syn keyword djangoFilter contained pprint random removetags rjust slice slugify | 
					
						
							|  |  |  | syn keyword djangoFilter contained safe safeseq stringformat striptags | 
					
						
							| 
									
										
										
										
											2012-04-13 23:04:47 +02:00
										 |  |  | syn keyword djangoFilter contained time timesince timeuntil title truncatechars | 
					
						
							| 
									
										
										
										
											2010-01-06 20:54:52 +01:00
										 |  |  | syn keyword djangoFilter contained truncatewords truncatewords_html unordered_list upper urlencode | 
					
						
							| 
									
										
										
										
											2006-03-23 22:59:57 +00:00
										 |  |  | syn keyword djangoFilter contained urlize urlizetrunc wordcount wordwrap yesno | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-05-05 17:59:48 +00:00
										 |  |  | " Keywords to highlight within comments | 
					
						
							|  |  |  | syn keyword djangoTodo contained TODO FIXME XXX | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-03-23 22:59:57 +00:00
										 |  |  | " Django template constants (always surrounded by double quotes) | 
					
						
							|  |  |  | syn region djangoArgument contained start=/"/ skip=/\\"/ end=/"/ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-05-05 17:59:48 +00:00
										 |  |  | " Mark illegal characters within tag and variables blocks | 
					
						
							| 
									
										
										
										
											2010-05-20 21:46:00 +02:00
										 |  |  | syn match djangoTagError contained "#}\|{{\|[^%]}}\|[&#]" | 
					
						
							| 
									
										
										
										
											2007-05-10 18:29:51 +00:00
										 |  |  | syn match djangoVarError contained "#}\|{%\|%}\|[<>!&#%]" | 
					
						
							| 
									
										
										
										
											2007-05-05 17:59:48 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-03-23 22:59:57 +00:00
										 |  |  | " Django template tag and variable blocks | 
					
						
							| 
									
										
										
										
											2007-05-05 17:59:48 +00:00
										 |  |  | syn region djangoTagBlock start="{%" end="%}" contains=djangoStatement,djangoFilter,djangoArgument,djangoTagError display | 
					
						
							|  |  |  | syn region djangoVarBlock start="{{" end="}}" contains=djangoFilter,djangoArgument,djangoVarError display | 
					
						
							| 
									
										
										
										
											2006-03-23 22:59:57 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-05-05 17:59:48 +00:00
										 |  |  | " Django template 'comment' tag and comment block | 
					
						
							| 
									
										
										
										
											2014-07-26 13:40:44 +02:00
										 |  |  | syn region djangoComment start="{%\s*comment\(\s\+.\{-}\)\?%}" end="{%\s*endcomment\s*%}" contains=djangoTodo | 
					
						
							| 
									
										
										
										
											2007-05-05 17:59:48 +00:00
										 |  |  | syn region djangoComBlock start="{#" end="#}" contains=djangoTodo | 
					
						
							| 
									
										
										
										
											2006-03-23 22:59:57 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | " Define the default highlighting. | 
					
						
							| 
									
										
										
										
											2016-08-30 23:26:57 +02:00
										 |  |  | " Only when an item doesn't have highlighting yet | 
					
						
							| 
									
										
										
										
											2006-03-23 22:59:57 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-31 22:22:10 +02:00
										 |  |  | hi def link djangoTagBlock PreProc | 
					
						
							|  |  |  | hi def link djangoVarBlock PreProc | 
					
						
							|  |  |  | hi def link djangoStatement Statement | 
					
						
							|  |  |  | hi def link djangoFilter Identifier | 
					
						
							|  |  |  | hi def link djangoArgument Constant | 
					
						
							|  |  |  | hi def link djangoTagError Error | 
					
						
							|  |  |  | hi def link djangoVarError Error | 
					
						
							|  |  |  | hi def link djangoError Error | 
					
						
							|  |  |  | hi def link djangoComment Comment | 
					
						
							|  |  |  | hi def link djangoComBlock Comment | 
					
						
							|  |  |  | hi def link djangoTodo Todo | 
					
						
							| 
									
										
										
										
											2006-03-23 22:59:57 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | let b:current_syntax = "django" |