@register.tag
def 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])
{% capture as [foo] %}
dataset/ETHPy150Open ericholscher/devmason-server/devmason_server/templatetags/capture.py/capture