+"""
+.. 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 <template_code> %}
+
+"""
+
from django import template
from django.conf import settings
class IncludeStringNode(template.Node):
- """The passed variable is expected to be a string of template code to be rendered with
- the current context."""
def __init__(self, string):
self.string = string
def do_include_string(parser, token):
- """
- Include a flat string by interpreting it as a template.
-
- Usage::
-
- {% include_string <template_code> %}
-
- """
bits = token.split_contents()
if len(bits) != 2:
raise TemplateSyntaxError("%r tag takes one argument: the template string to be included" % bits[0])