remove unused states from html parser

This commit is contained in:
Alan Hamlett 2016-09-01 12:41:20 +02:00
parent 48591d2767
commit f9cd857d90

View file

@ -114,16 +114,11 @@ class HtmlDjangoParser(TokenParser):
if self.opening_tag: if self.opening_tag:
self.tags.insert(0, content.replace('<', '', 1).strip().lower()) self.tags.insert(0, content.replace('<', '', 1).strip().lower())
self.getting_attrs = True self.getting_attrs = True
elif content.startswith('>'):
self.opening_tag = False
self.getting_attrs = False
self.current_attr = None self.current_attr = None
def _process_attribute(self, token, content): def _process_attribute(self, token, content):
if self.getting_attrs: if self.getting_attrs:
self.current_attr = content.lower().strip('=') self.current_attr = content.lower().strip('=')
else:
self.current_attr = None
self.current_attr_value = None self.current_attr_value = None
def _process_string(self, token, content): def _process_string(self, token, content):
@ -146,8 +141,6 @@ class HtmlDjangoParser(TokenParser):
elif content.startswith('"') or content.startswith("'"): elif content.startswith('"') or content.startswith("'"):
if self.current_attr_value is None: if self.current_attr_value is None:
self.current_attr_value = content self.current_attr_value = content
else:
self.current_attr_value += content
class VelocityHtmlParser(HtmlDjangoParser): class VelocityHtmlParser(HtmlDjangoParser):