diff options
author | Kornelius Kalnbach <murphy@rubychan.de> | 2011-08-21 20:53:10 +0200 |
---|---|---|
committer | Kornelius Kalnbach <murphy@rubychan.de> | 2011-08-21 20:53:10 +0200 |
commit | a907cf0c1915ce98972c26f17bd10ac108efd182 (patch) | |
tree | aa5ce2b2b59ff16521094ca25e6458275fb8f6b3 | |
parent | f2660beaee1d7615a6d152b0e27b7ea04f2652ab (diff) | |
download | coderay-a907cf0c1915ce98972c26f17bd10ac108efd182.tar.gz |
fix HTML scanner to correctly highlight embedded Ruby inside of attribute values
-rw-r--r-- | lib/coderay/scanners/html.rb | 12 |
1 files changed, 6 insertions, 6 deletions
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 |