Implement {% while ... %}
This commit is contained in:
parent
259f6f3c29
commit
a2ebec3218
@ -109,6 +109,13 @@ class Parser:
|
||||
# {% endpage %}
|
||||
self.emitter.end_page()
|
||||
self.in_html = False
|
||||
elif command.startswith('while '):
|
||||
# {% while ... %}
|
||||
condition = command[len('while '):].strip()
|
||||
self.emitter.emit('while (' + condition + ') {')
|
||||
elif command == 'endwhile':
|
||||
# {% endwhile %}
|
||||
self.emitter.emit('}')
|
||||
else:
|
||||
raise SyntaxError(f'Unknown command "{command}"')
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user