Implement {% for ... %}

This commit is contained in:
RunasSudo 2025-05-14 18:27:41 +10:00
parent 269f0a6e8f
commit 864217a9bd
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A

View File

@ -79,6 +79,13 @@ class Parser:
# {% endblock %}
self.emitter.end_block()
self.in_html = False
elif command.startswith('for '):
# {% for ... %}
for_defn = command[len('if '):].strip()
self.emitter.emit('for (' + for_defn + ') {')
elif command == 'endfor':
# {% endfor %}
self.emitter.emit('}')
elif command.startswith('if '):
# {% if ... %}
condition = command[len('if '):].strip()