From: noah morrison Date: Sat, 1 Nov 2014 16:49:53 +0000 (-0400) Subject: Added some documentation X-Git-Url: https://git.devinivas.org/?a=commitdiff_plain;h=e2ce84b8ca321afb90f894fc9732bf0a50ff6eea;p=chevron.git Added some documentation Documented the tokenize function. --- 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