Skip to content
This repository
Browse code

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

… tag.
  • Loading branch information...
commit f5bb55cc14cc17bc4665347fe6c2e11145101624 1 parent 5f54b36
Kornelius Kalnbach authored October 07, 2012
1  Changes.textile
Source Rendered
@@ -7,6 +7,7 @@ p=. _This files lists all changes in the CodeRay library since the 0.9.8 release
7 7
 h2. Next Version
8 8
  
9 9
 * add @:string/:char@, remove @:regexp/:function@ color from Terminal encoder [GH #29, thanks to Kyrylo Silin]
  10
+* Fix HTML scanner: Don't crash if HTML in a diff contains a JavaScript tag.
10 11
 
11 12
 h2. Changes in 1.0.7
12 13
  
5  lib/coderay/scanners/html.rb
@@ -69,6 +69,7 @@ def reset
69 69
     def setup
70 70
       @state = :initial
71 71
       @plain_string_content = nil
  72
+      @in_tag = nil
72 73
     end
73 74
     
74 75
     def scan_java_script encoder, code
@@ -83,7 +84,8 @@ def scan_java_script encoder, code
83 84
     def scan_tokens encoder, options
84 85
       state = options[:state] || @state
85 86
       plain_string_content = @plain_string_content
86  
-      in_tag = in_attribute = nil
  87
+      in_tag = @in_tag
  88
+      in_attribute = nil
87 89
       
88 90
       encoder.begin_group :string if state == :attribute_value_string
89 91
       
@@ -237,6 +239,7 @@ def scan_tokens encoder, options
237 239
       if options[:keep_state]
238 240
         @state = state
239 241
         @plain_string_content = plain_string_content
  242
+        @in_tag = in_tag
240 243
       end
241 244
       
242 245
       encoder.end_group :string if state == :attribute_value_string

0 notes on commit f5bb55c

Please sign in to comment.
Something went wrong with that request. Please try again.