tag to determine if a link is to the current page, and if it is, sets 'link_active'
        to True in the context.

        Use:
            {% active path view strict[True,False] arg1 arg2 arg3 %}

            path:   the path to check. Generally this is just 'request.path'
            view:   the view that you want to check against the path. (uses reverse)
            strict: if strict is true, then the two paths need to be exactly the same.
                    if strict is false, then a path of /some/path/ and a view with the url
                    /some/ will match.
            args:   args needed by the given view to get its path using reverse.

        Example:
            {% active request.path "settings" True %}
            <a href="{% url settings %}" class="{% if link_active %} active{% endif %}">

def active(parser, token):
    """ tag to determine if a link is to the current page, and if it is, sets 'link_active'
        to True in the context.

        Use:
            {% active path view strict[True,False] arg1 arg2 arg3 %}

            path:   the path to check. Generally this is just 'request.path'
            view:   the view that you want to check against the path. (uses reverse)
            strict: if strict is true, then the two paths need to be exactly the same.
                    if strict is false, then a path of /some/path/ and a view with the url
                    /some/ will match.
            args:   args needed by the given view to get its path using reverse.

        Example:
            {% active request.path "settings" True %}
            <a href="{% url settings %}" class="{% if link_active %} active{% endif %}">

        """
    args = token.split_contents()
    path = args[1]
    view = args[2].replace('"', '').replace("'", '')
    strict = args[3].replace('"', '').replace("'", '')

    arg1 = None; arg2 = None; arg3 = None
    if len(args) > 4:
        arg1 = args[4]
    if len(args) > 5:
        arg2 = args[5]
    if len(args) > 6:
        arg3 = args[6]
    if not view:
        raise template.TemplateSyntaxError, "%r tag requires at least one view argument" % token.contents.split()[0]
    return ActiveTag(view, path, strict, arg1, arg2, arg3)