diff options
| author | Kornelius Kalnbach <murphy@rubychan.de> | 2013-03-10 22:47:00 +0100 |
|---|---|---|
| committer | Kornelius Kalnbach <murphy@rubychan.de> | 2013-03-10 22:47:00 +0100 |
| commit | 0c98047ea276f393daa8249cf9c124ebc08266d2 (patch) | |
| tree | 71e7333e04e7fd1ff12fa9351886faeec2701671 /lib/coderay/scanners/html.rb | |
| parent | 250373646c32e3c135fb4068b195b578cbdc5870 (diff) | |
| parent | fc16be24d48f8a729ac987149f98f19725943e0d (diff) | |
| download | coderay-0c98047ea276f393daa8249cf9c124ebc08266d2.tar.gz | |
Merge branch 'master' into paint-integration
Diffstat (limited to 'lib/coderay/scanners/html.rb')
| -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 98d06fc..3ba3b79 100644 --- a/lib/coderay/scanners/html.rb +++ b/lib/coderay/scanners/html.rb @@ -69,6 +69,7 @@ module Scanners def setup @state = :initial @plain_string_content = nil + @in_tag = nil end def scan_java_script encoder, code @@ -83,7 +84,8 @@ module Scanners def scan_tokens encoder, options state = options[:state] || @state plain_string_content = @plain_string_content - in_tag = in_attribute = nil + in_tag = @in_tag + in_attribute = nil encoder.begin_group :string if state == :attribute_value_string @@ -99,7 +101,7 @@ module Scanners when :initial if match = scan(/<!--(?:.*?-->|.*)/m) encoder.text_token match, :comment - elsif match = scan(/<!DOCTYPE(?:.*?>|.*)/m) + elsif match = scan(/<!(\w+)(?:.*?>|.*)|\]>/m) encoder.text_token match, :doctype elsif match = scan(/<\?xml(?:.*?\?>|.*)/m) encoder.text_token match, :preprocessor @@ -149,12 +151,9 @@ module Scanners if match = scan(/=/) #/ encoder.text_token match, :operator state = :attribute_value - elsif scan(/#{ATTR_NAME}/o) || scan(/#{TAG_END}/o) - state = :attribute - next else - encoder.text_token getch, :error state = :attribute + next end when :attribute_value @@ -240,6 +239,7 @@ module Scanners if options[:keep_state] @state = state @plain_string_content = plain_string_content + @in_tag = in_tag end encoder.end_group :string if state == :attribute_value_string |
