(self)
| 253 | return nodes.Scope([node]) |
| 254 | |
| 255 | def parse_block(self): |
| 256 | node = nodes.Block(lineno=next(self.stream).lineno) |
| 257 | node.name = self.stream.expect('name').value |
| 258 | node.scoped = self.stream.skip_if('name:scoped') |
| 259 | |
| 260 | # common problem people encounter when switching from django |
| 261 | # to jinja. we do not support hyphens in block names, so let's |
| 262 | # raise a nicer error message in that case. |
| 263 | if self.stream.current.type == 'sub': |
| 264 | self.fail('Block names in Jinja have to be valid Python ' |
| 265 | 'identifiers and may not contain hyphens, use an ' |
| 266 | 'underscore instead.') |
| 267 | |
| 268 | node.body = self.parse_statements(('name:endblock',), drop_needle=True) |
| 269 | self.stream.skip_if('name:' + node.name) |
| 270 | return node |
| 271 | |
| 272 | def parse_extends(self): |
| 273 | node = nodes.Extends(lineno=next(self.stream).lineno) |
nothing calls this directly
no test coverage detected