X-Git-Url: http://git.ithinksw.org/philo.git/blobdiff_plain/1324f9b1e4d57c5ab50bc264507f7adc3207eb99..0959d38b27c03863ec376839dcc6d896d04e36ea:/philo/templatetags/include_string.py diff --git a/philo/templatetags/include_string.py b/philo/templatetags/include_string.py index ecf9b45..cb0a8b5 100644 --- a/philo/templatetags/include_string.py +++ b/philo/templatetags/include_string.py @@ -1,17 +1,3 @@ -""" -.. templatetag:: include_string - -include_string --------------- - -Include a flat string by interpreting it as a template. The compiled template will be rendered with the current context. - -Usage:: - - {% include_string %} - -""" - from django import template from django.conf import settings @@ -35,12 +21,18 @@ class IncludeStringNode(template.Node): return settings.TEMPLATE_STRING_IF_INVALID -def do_include_string(parser, token): +@register.tag +def include_string(parser, token): + """ + Include a flat string by interpreting it as a template. The compiled template will be rendered with the current context. + + Usage:: + + {% include_string %} + + """ bits = token.split_contents() if len(bits) != 2: raise TemplateSyntaxError("%r tag takes one argument: the template string to be included" % bits[0]) string = parser.compile_filter(bits[1]) - return IncludeStringNode(string) - - -register.tag('include_string', do_include_string) \ No newline at end of file + return IncludeStringNode(string) \ No newline at end of file