mirror of
https://github.com/zulip/zulip.git
synced 2025-11-07 23:43:43 +00:00
check_templates: Parse '<foo/>' tags better.
If folks put something like '<br/>' in the HTML,
we would think the tag's name was "br/" instead
of "br". I think we were assuming most folks
would write either "<br>" or <br />".
ASIDE:
We should probably have a consistent
preference among these styles:
* <br>
* <br/>
* <br />
I prefer the first.
This commit is contained in:
@@ -103,7 +103,11 @@ def tokenize(text: str) -> List[Token]:
|
|||||||
kind = 'handlebars_singleton'
|
kind = 'handlebars_singleton'
|
||||||
elif looking_at_html_start():
|
elif looking_at_html_start():
|
||||||
s = get_html_tag(text, state.i)
|
s = get_html_tag(text, state.i)
|
||||||
tag_parts = s[1:-1].split()
|
if s.endswith('/>'):
|
||||||
|
end_offset = -2
|
||||||
|
else:
|
||||||
|
end_offset = -1
|
||||||
|
tag_parts = s[1:end_offset].split()
|
||||||
|
|
||||||
if not tag_parts:
|
if not tag_parts:
|
||||||
raise TemplateParserException("Tag name missing")
|
raise TemplateParserException("Tag name missing")
|
||||||
|
|||||||
Reference in New Issue
Block a user