from django import template
from django.utils.html import mark_safe


register = template.Library()


@register.simple_tag(takes_context=True)
def define(context, key, *args):
    if len(args) == 1:
        context.dicts[0][key] = args[0]

    else:
        context.dicts[0][key] = [mark_safe(arg) for arg in args]

    return ""
