]> git.ipfire.org Git - thirdparty/jinja.git/commitdiff
[svn] some small fixes for the jinja release
authorArmin Ronacher <armin.ronacher@active-4.com>
Fri, 23 Mar 2007 15:13:10 +0000 (16:13 +0100)
committerArmin Ronacher <armin.ronacher@active-4.com>
Fri, 23 Mar 2007 15:13:10 +0000 (16:13 +0100)
--HG--
branch : trunk

Makefile
jinja/lexer.py
jinja/parser.py

index eb6d0731846bc9cac206380827bc8a8b43f02875..8fcff87620ca2eadf73d5821d19943fc8491a56c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -15,7 +15,7 @@ documentation:
        @(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)
index ed5e341a64de3f7e4183826bc6d1c69091795a5a..d419c0397bdd594e0bdd43b60090dce68e52e7cd 100644 (file)
@@ -133,9 +133,10 @@ class Lexer(object):
     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
index 5994fb8bdc61bd023c8bd07a6e1848303258917b..e447733d07471e84dc2d05c136a3fc8a1559e954 100644 (file)
@@ -582,7 +582,16 @@ class Parser(object):
                 # 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)