lib/coderay/scanners/html.rb in coderay-1.0.0.815pre vs lib/coderay/scanners/html.rb in coderay-1.0.0.831pre

- old
+ new

@@ -30,11 +30,11 @@ onredo onreset onresize onscroll onseeked onseeking onselect onshow onstalled onstorage onsubmit onsuspend ontimeupdate onundo onunload onvolumechange onwaiting ) - IN_ATTRIBUTE = CaseIgnoringWordList.new(nil). + IN_ATTRIBUTE = WordList::CaseIgnoring.new(nil). add(EVENT_ATTRIBUTES, :script) ATTR_NAME = /[\w.:-]+/ # :nodoc: TAG_END = /\/?>/ # :nodoc: HEX = /[0-9a-fA-F]/ # :nodoc: @@ -56,14 +56,14 @@ PLAIN_STRING_CONTENT = { "'" => /[^&'>\n]+/, '"' => /[^&">\n]+/, } # :nodoc: - def reset # :nodoc: - # FIXME: why not overwrite reset_instance? + def reset super @state = :initial + @plain_string_content = nil end protected def setup @@ -79,15 +79,16 @@ # encoder.end_group :inline end end def scan_tokens encoder, options - state = @state plain_string_content = @plain_string_content in_tag = in_attribute = nil + encoder.begin_group :string if state == :attribute_value_string + until eos? if state != :in_special_tag && match = scan(/\s+/m) encoder.text_token match, :space @@ -237,14 +238,12 @@ end if options[:keep_state] @state = state @plain_string_content = plain_string_content - else - if state == :attribute_value_string - encoder.end_group :string - end end + + encoder.end_group :string if state == :attribute_value_string encoder end end