@register.tag
def snippet(parser, token):
    """
    Demarcates replaceable text, outputs the wrapped text or the text of a
    snippet with matching key.

    Examples::

        {% snippet 'greeting' %}Hello world{% endsnippet %}

        {% snippet 'greeting' safe=True %}<p>Hey!</p>{% endsnippet %}
    """
    nodelist = parser.parse(('endsnippet',))
    parser.delete_first_token()

    bits = token.split_contents()
    tag_name = bits[0]
    try:
        key = bits[1]
    except IndexError:
        raise TemplateSyntaxError("%s tag takes at least one argument" % tag_name)

    options = build_options(bits[2:], tag_name)

    return SnippetNode(nodelist, key, **options)
dataset/ETHPy150Open bennylope/django-addendum/addendum/templatetags/addendum_tags.py/snippet/original