Clean up handling of HTML tags in check-templates.

(imported from commit 10f3ce97eecefcedc806d1a6a20ad230ebcf1f0f)
This commit is contained in:
Steve Howell 2014-02-27 16:33:59 -05:00 committed by Jessica McKellar
parent a07299f1d6
commit 98bc0b04c5
1 changed files with 14 additions and 10 deletions

View File

@ -67,13 +67,9 @@ def validate(fn, check_indent=True):
while state.i < len(text): while state.i < len(text):
c = text[state.i] # HTML tags
if c == '<': if looking_at("<") and not looking_at("</"):
s = get_html_tag(text, state.i) s = get_html_tag(text, state.i)
if s.startswith('</'):
end_tag = s[2:-1]
state.matcher(end_tag)
else:
tag = s[1:-1].split()[0] tag = s[1:-1].split()[0]
ignore = s.startswith('<!--') or s.endswith('/>') or tag in ['meta', '!DOCTYPE'] ignore = s.startswith('<!--') or s.endswith('/>') or tag in ['meta', '!DOCTYPE']
if not ignore: if not ignore:
@ -81,6 +77,14 @@ def validate(fn, check_indent=True):
advance(len(s)) advance(len(s))
continue continue
if looking_at("</"):
s = get_html_tag(text, state.i)
end_tag = s[2:-1]
state.matcher(end_tag)
advance(len(s))
continue
# Handlebar tags
if looking_at("{{#") or looking_at("{{^"): if looking_at("{{#") or looking_at("{{^"):
s = get_handlebars_tag(text, state.i) s = get_handlebars_tag(text, state.i)
tag = s[3:-2].split()[0] tag = s[3:-2].split()[0]