Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

template_parser: Handle else/elif with whitespace control.

Tim Abbott01c3c4dd4bc9
diff --git a/tools/lib/template_parser.py b/tools/lib/template_parser.py
index 76b8f698167..fc1d35643a0 100644
--- a/tools/lib/template_parser.py
+++ b/tools/lib/template_parser.py
@@ -103,7 +103,12 @@ def tokenize(text: str, template_format: Optional[str] = None) -> List[Token]:
return template_format == "django" and looking_at("{% ")
def looking_at_django_else() -> bool:
- return template_format == "django" and (looking_at("{% else") or looking_at("{% elif"))
+ return template_format == "django" and (
+ looking_at("{% else")
+ or looking_at("{% elif")
+ or looking_at("{%- else")
+ or looking_at("{%- elif")
+ )
def looking_at_django_end() -> bool:
return template_format == "django" and looking_at("{% end")