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,20 +67,24 @@ def validate(fn, check_indent=True):
while state.i < len(text):
c = text[state.i]
if c == '<':
# HTML tags
if looking_at("<") and not looking_at("</"):
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]
ignore = s.startswith('<!--') or s.endswith('/>') or tag in ['meta', '!DOCTYPE']
if not ignore:
start_tag_matcher(s, tag)
tag = s[1:-1].split()[0]
ignore = s.startswith('<!--') or s.endswith('/>') or tag in ['meta', '!DOCTYPE']
if not ignore:
start_tag_matcher(s, tag)
advance(len(s))
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("{{^"):
s = get_handlebars_tag(text, state.i)
tag = s[3:-2].split()[0]