From e2ce84b8ca321afb90f894fc9732bf0a50ff6eea Mon Sep 17 00:00:00 2001 From: noah morrison Date: Sat, 1 Nov 2014 12:49:53 -0400 Subject: [PATCH] Added some documentation Documented the tokenize function. --- chevron.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/chevron.py b/chevron.py index 0edf757..fc845da 100755 --- a/chevron.py +++ b/chevron.py @@ -5,6 +5,31 @@ from io import StringIO def tokenize(template): + """Tokenize a mustache template + + Tokenizes a mustache template in a generator fashion, + using file-like objects. It also accepts a string containing + the template. + + Arguments: + template -- a file-like object, or a string of a mustache template + + Returns: + A generator of mustache tags in the form of a tuple + -- (tag_type, tag_key) + + Where tag_type is one of: + * literal + * comment + * section + * inverted section + * end + * partial + * no escape + And tag_key is either the key or in the case of a literal tag, + the literal itself. + """ + class UnclosedSection(Exception): pass -- 2.47.3