@(cd docs; ./generate.py)
webpage:
- @(cd www; ./generate.py)
+ @(cd ../www; ./generate.py)
release:
@(python2.3 setup.py release bdist_egg; python2.4 setup.py release bdist_egg; python2.5 setup.py release bdist_egg sdist)
def tokeniter(self, source):
"""
This method tokenizes the text and returns the tokens in a generator.
- Normally it's a better idea to use the `tokenize` function which
- returns a `TokenStream` but in some situations it can be useful
- to use this function since it can be marginally faster.
+ Use this method if you just want to tokenize a template. The output
+ you get is not compatible with the input the jinja parser wants. The
+ parser uses the `tokenize` function with returns a `TokenStream` with
+ some escaped tokens.
"""
source = type(source)('\n').join(source.splitlines())
pos = 0
# template syntax error.
if data in self.directives:
node = self.directives[data](lineno, gen)
+ # directive or endtag found, give a proper error message
+ elif data in self.directives or \
+ not data.endswith('_') and data.startswith('end'):
+ raise TemplateSyntaxError('unexpected directive %r' %
+ str(data), lineno,
+ self.filename)
+ # keyword or unknown name with trailing slash
else:
+ if data.endswith('_'):
+ data = data[:-1]
raise TemplateSyntaxError('unknown directive %r' %
str(data), lineno,
self.filename)