def new_char()
case
when @start_tag == 1 && current_char == ' '
self.element_name = self.data.strip.downcase
self.data = ""
@start_tag = 2
when @start_tag == 1 && previous_char == '/' && current_char == '>'
self.data.chop!
self.element_name = self.data.strip.downcase
self.data = ""
@start_tag = 0
return false
when @start_tag == 1 && previous_char != '/' && current_char == '>'
self.element_name = self.data.strip.downcase
self.data = ""
@start_tag = 0
return false if SHORT_TAGS.include?(self.element_name)
return false if self.element_name == @tag_check && NO_NEED_TO_CLOSE.include?(self.element_name)
when @start_tag == 2 && current_char == ' ' && self.in_quotes? == false
self.current_param = self.data
self.data = ""
self.params << ""
when @start_tag == 2 && current_char == '=' && self.in_quotes? == false
self.current_param = self.data
self.data = ""
self.name_current_param()
when @start_tag == 2 && previous_char != '/' && current_char == '>'
self.current_param = self.data
self.data = ""
@start_tag = 0
return false if SHORT_TAGS.include?(self.element_name)
return false if self.element_name == @tag_check && NO_NEED_TO_CLOSE.include?(self.element_name)
when @start_tag == 2 && previous_char == '/' && current_char == '>'
self.current_param = self.data.chop
self.data = ""
@start_tag = 0
return false
when @start_tag == 2 && current_char == "'" && previous_char != '\\' && !@in_quotes
@in_single_quotes = !@in_single_quotes
when @start_tag == 2 && current_char == '"' && previous_char != '\\' && !@in_single_quotes
@in_quotes = !@in_quotes
when @start_tag == 0 && previous_char == '<' && current_char == '/'
self.element_content += self.data.chop
self.data = ""
@start_tag = 5
when @start_tag == 5 && (current_char == '>' || current_char == ' ') && !self.data.blank?
self.data = self.data.strip.downcase
if self.data == self.element_name
self.data = ""
return false
else
if @tag_check == self.data && NO_NEED_TO_CLOSE.include?(self.element_name)
self.data = "</#{self.data}>"
return false
else
self.element_content += skip_html? ? "</#{self.data}>" : "</#{self.data}>"
@start_tag = 0
self.data = ""
end
end
else
if @start_tag == 0 && ESCAPED_TAGS.include?(self.element_name)
self.data << self.escape_char(current_char)
else
self.data << current_char
end
end
return true
end