Skip to content

Instantly share code, notes, and snippets.

@actuosus
Created May 26, 2010 12:51
Show Gist options
  • Save actuosus/414430 to your computer and use it in GitHub Desktop.
Save actuosus/414430 to your computer and use it in GitHub Desktop.
XPTemplate priority=lang-
let s:f = g:XPTfuncs()
XPTvar $CL {#
XPTvar $CR #}
XPTinclude
\ _common/common
XPTembed
\ html/html
let s:nIndent = 0
fun! s:f.html_cont_ontype()
let v = self.V()
if v =~ '\V\n'
let v = matchstr( v, '\V\.\*\ze\n' )
let s:nIndent = &indentexpr != ''
\ ? eval( substitute( &indentexpr, '\Vv:lnum', 'line(".")', '' ) ) - indent( line( "." ) - 1 )
\ : self.NIndent()
return self.Finish( v . "\n" . repeat( ' ', s:nIndent ) )
else
return v
endif
endfunction
XPT django_tag hidden " {% $_xSnipName %}..{% end$_xSnipName %}
{% `$_xSnipName^ %}`cursor^{% end`$_xSnipName^ %}
..XPT
XPT django_short_tag hidden " {% $_xSnipName .. %}
{% `$_xSnipName^ `cursor^%}
XPT trans
{% trans "`cursor^" %}
XPT block
{% block `name^ %}
`cursor^
{%endblock `name^ %}
XPT comment alias=django_tag
XPT csrf_token alias=django_short_tag
" cycle
XPT debug alias=django_short_tag
XPT extends
{% extends "`template_path^" %}
XPT if
{% if `condition^ %}
`so^
{% else %}
`otherwise^
{%endif}
XPT for
{% for `item^ in `range^ %}
{{ `item^`cursor^ }}
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment