Permalink
Browse files

Fix HTML scanner: Don't crash if HTML in a diff contains a JavaScript…

… tag.
  • Loading branch information...
1 parent 5f54b36 commit f5bb55cc14cc17bc4665347fe6c2e11145101624 @korny korny committed Oct 7, 2012
Showing with 5 additions and 1 deletion.
  1. +1 −0 Changes.textile
  2. +4 −1 lib/coderay/scanners/html.rb
View
@@ -7,6 +7,7 @@ p=. _This files lists all changes in the CodeRay library since the 0.9.8 release
h2. Next Version
* add @:string/:char@, remove @:regexp/:function@ color from Terminal encoder [GH #29, thanks to Kyrylo Silin]
+* Fix HTML scanner: Don't crash if HTML in a diff contains a JavaScript tag.
h2. Changes in 1.0.7
@@ -69,6 +69,7 @@ def reset
def setup
@state = :initial
@plain_string_content = nil
+ @in_tag = nil
end
def scan_java_script encoder, code
@@ -83,7 +84,8 @@ def scan_java_script encoder, code
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
@@ -237,6 +239,7 @@ def scan_tokens encoder, options
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

0 comments on commit f5bb55c

Please sign in to comment.