(self, name, end_token_stack, lineno)
| 59 | raise exc(msg, lineno, self.name, self.filename) |
| 60 | |
| 61 | def _fail_ut_eof(self, name, end_token_stack, lineno): |
| 62 | expected = [] |
| 63 | for exprs in end_token_stack: |
| 64 | expected.extend(imap(describe_token_expr, exprs)) |
| 65 | if end_token_stack: |
| 66 | currently_looking = ' or '.join( |
| 67 | "'%s'" % describe_token_expr(expr) |
| 68 | for expr in end_token_stack[-1]) |
| 69 | else: |
| 70 | currently_looking = None |
| 71 | |
| 72 | if name is None: |
| 73 | message = ['Unexpected end of template.'] |
| 74 | else: |
| 75 | message = ['Encountered unknown tag \'%s\'.' % name] |
| 76 | |
| 77 | if currently_looking: |
| 78 | if name is not None and name in expected: |
| 79 | message.append('You probably made a nesting mistake. Jinja ' |
| 80 | 'is expecting this tag, but currently looking ' |
| 81 | 'for %s.' % currently_looking) |
| 82 | else: |
| 83 | message.append('Jinja was looking for the following tags: ' |
| 84 | '%s.' % currently_looking) |
| 85 | |
| 86 | if self._tag_stack: |
| 87 | message.append('The innermost block that needs to be ' |
| 88 | 'closed is \'%s\'.' % self._tag_stack[-1]) |
| 89 | |
| 90 | self.fail(' '.join(message), lineno) |
| 91 | |
| 92 | def fail_unknown_tag(self, name, lineno=None): |
| 93 | """Called if the parser encounters an unknown tag. Tries to fail |
no test coverage detected