Total Complexity | 3 |
Total Lines | 14 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | # -*- coding: utf-8 -*- |
||
7 | class HelloExtension(Extension): |
||
8 | tags = set(['hello']) |
||
9 | |||
10 | def __init__(self, environment): |
||
11 | super(HelloExtension, self).__init__(environment) |
||
12 | |||
13 | def _hello(self, name): |
||
14 | return 'Hello {name}!'.format(name=name) |
||
15 | |||
16 | def parse(self, parser): |
||
17 | lineno = next(parser.stream).lineno |
||
18 | node = parser.parse_expression() |
||
19 | call_method = self.call_method('_hello', [node], lineno=lineno) |
||
20 | return nodes.Output([call_method], lineno=lineno) |
||
21 |