(parser, token)
return CaptureasNode(nodelist, args)
Assign to a context variable from within a template
        {% captureas my_context_var %}<!-- anything -->{% endcaptureas %}
        <h1>Nice job capturing {{ my_context_var }}</h1>
Assign to a context variable from within a template
        {% captureas my_context_var %}<!-- anything -->{% endcaptureas %}
        <h1>Nice job capturing {{ my_context_var }}</h1>
Assign to a context variable from within a template { % captureas my_context_var % } <! -- anything -- > { % endcaptureas % } <h1 > Nice job capturing {{ my_context_var }} < / h1 >
def do_captureas(parser, token):
    """
    Assign to a context variable from within a template
        {% captureas my_context_var %}<!-- anything -->{% endcaptureas %}
        <h1>Nice job capturing {{ my_context_var }}</h1>
    """
    try:
        tag_name, args = token.contents.split(None, 1)
    except ValueError:
        raise template.TemplateSyntaxError("'captureas' node requires a "
                                           "variable name.")
    nodelist = parser.parse(('endcaptureas',))
    parser.delete_first_token()
    return CaptureasNode(nodelist, args)
def do_captureas ( parser , token ) : try : tag_name , args = token . contents . split ( None , 1 ) except ValueError : raise template . TemplateSyntaxError ( "'captureas' node requires a " "variable name." ) nodelist = parser . parse ( ( 'endcaptureas' , ) ) parser . delete_first_token ( ) return CaptureasNode ( nodelist , args )