From a907cf0c1915ce98972c26f17bd10ac108efd182 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 21 Aug 2011 20:53:10 +0200 Subject: fix HTML scanner to correctly highlight embedded Ruby inside of attribute values --- lib/coderay/scanners/html.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lib/coderay/scanners') diff --git a/lib/coderay/scanners/html.rb b/lib/coderay/scanners/html.rb index 206ace0..fcf89cb 100644 --- a/lib/coderay/scanners/html.rb +++ b/lib/coderay/scanners/html.rb @@ -58,9 +58,10 @@ module Scanners '"' => /[^&">\n]+/, } # :nodoc: - def reset_instance # :nodoc: + def reset super @state = :initial + @plain_string_content = nil end protected @@ -80,11 +81,12 @@ module Scanners 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) @@ -238,12 +240,10 @@ module Scanners 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 -- cgit v1.2.1