--- a/django/template/__init__.py +++ b/django/template/__init__.py @@ -35,6 +35,22 @@ will be raised if the template doesn't have proper syntax. Sample code: >>> from django import template +>>> s = u'{% extends "base" %}{% block a %}--{% endblock %}' +>>> l = template.Lexer(s,'') +>>> tokens = l.tokenize() + +You will now have 3 block tokens and a text token + +>>> tokens[0].content +u'extends "base"' +>>> tokens[1].content +u' extends "base"' +>>> tokens[2].content +u' block a' +>>> tokens[3].content +u' endblock' + +>>> from django import template >>> s = u'{% if test %}

{{ varvalue }}

{% endif %}' >>> t = template.Template(s)