Implement {% if ... %}
This commit is contained in:
parent
21b5295cf3
commit
269f0a6e8f
@ -79,6 +79,20 @@ class Parser:
|
||||
# {% endblock %}
|
||||
self.emitter.end_block()
|
||||
self.in_html = False
|
||||
elif command.startswith('if '):
|
||||
# {% if ... %}
|
||||
condition = command[len('if '):].strip()
|
||||
self.emitter.emit('if (' + condition + ') {')
|
||||
elif command.startswith('elif '):
|
||||
# {% elif ... %}
|
||||
condition = command[len('elif '):].strip()
|
||||
self.emitter.emit('} else if (' + condition + ') {')
|
||||
elif command == 'else':
|
||||
# {% else %}
|
||||
self.emitter.emit('} else {')
|
||||
elif command == 'endif':
|
||||
# {% endif %}
|
||||
self.emitter.emit('}')
|
||||
elif command.startswith('page '):
|
||||
# {% page ... %}
|
||||
page_name = command[len('page '):].strip()
|
||||
|
Loading…
x
Reference in New Issue
Block a user