@register.tag('capture')
def do_capture(parser, token):
 bits = token.split_contents()
 if (len(bits) != 3):
  raise template.TemplateSyntaxError("'capture' node requires `as (variable name)`.")
 nodelist = parser.parse(('endcapture',))
 parser.delete_first_token()
 return CaptureNode(nodelist, bits[2])

@ register . tag ( 'capture' ) def do_capture ( parser , token ) : bits = token . split_contents ( ) if ( len ( bits ) != 3 ) : raise template . TemplateSyntaxError ( "'capture' node requires `as (variable name)`." ) nodelist = parser . parse ( ( 'endcapture' , ) ) parser . delete_first_token ( ) return CaptureNode ( nodelist , bits [ 2 ] )
captures content into a context variable .