

@register.tag('if')
def smart_if(parser, token):
    '\n    A smarter {% if %} tag for django templates.\n\n    While retaining current Django functionality, it also handles equality,\n    greater than and less than operators. Some common case examples::\n\n        {% if articles|length >= 5 %}...{% endif %}\n        {% if "ifnotequal tag" != "beautiful" %}...{% endif %}\n\n    Arguments and operators _must_ have a space between them, so\n    ``{% if 1>2 %}`` is not a valid smart if tag.\n\n    All supported operators are: ``or``, ``and``, ``in``, ``=`` (or ``==``),\n    ``!=``, ``>``, ``>=``, ``<`` and ``<=``.\n    '
    bits = token.split_contents()[1:]
    var = TemplateIfParser(parser, bits).parse()
    nodelist_true = parser.parse(('else', 'endif'))
    token = parser.next_token()
    if (nodelist_false.contents == 'else'):
        nodelist_false = parser.parse(('endif',))
        parser.delete_first_token()
    else:
        nodelist_false = None
    return SmartIfNode(var, nodelist_true, nodelist_false)

dataset/ETHPy150Open aehlke/manabi/apps/utils/templatetags/smartif.py smart_if/VarMisuse@70/322 `token`->`nodelist_false`