Revision 4e03ba30 snf-astakos-app/astakos/im/templatetags/astakos_tags.py

b/snf-astakos-app/astakos/im/templatetags/astakos_tags.py
268 268

  
269 269
    content = render_to_string(template, tpl_context)
270 270
    return content
271

  
272

  
273
class VerbatimNode(template.Node):
274

  
275
    def __init__(self, text):
276
        self.text = text
277

  
278
    def render(self, context):
279
        return self.text
280

  
281

  
282
@register.tag
283
def verbatim(parser, token):
284
    text = []
285
    while 1:
286
        token = parser.tokens.pop(0)
287
        if token.contents == 'endverbatim':
288
            break
289
        if token.token_type == template.TOKEN_VAR:
290
            text.append('{{')
291
        elif token.token_type == template.TOKEN_BLOCK:
292
            text.append('{%')
293
        text.append(token.contents)
294
        if token.token_type == template.TOKEN_VAR:
295
            text.append('}}')
296
        elif token.token_type == template.TOKEN_BLOCK:
297
            text.append('%}')
298
    return VerbatimNode(''.join(text))

Also available in: Unified diff