Skip to content

Commit f5bb55c

Browse files
committed
Fix HTML scanner: Don't crash if HTML in a diff contains a JavaScript tag.
1 parent 5f54b36 commit f5bb55c

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Changes.textile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ p=. _This files lists all changes in the CodeRay library since the 0.9.8 release
77
h2. Next Version
88

99
* 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.
1011

1112
h2. Changes in 1.0.7
1213

lib/coderay/scanners/html.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ def reset
6969
def setup
7070
@state = :initial
7171
@plain_string_content = nil
72+
@in_tag = nil
7273
end
7374

7475
def scan_java_script encoder, code
@@ -83,7 +84,8 @@ def scan_java_script encoder, code
8384
def scan_tokens encoder, options
8485
state = options[:state] || @state
8586
plain_string_content = @plain_string_content
86-
in_tag = in_attribute = nil
87+
in_tag = @in_tag
88+
in_attribute = nil
8789

8890
encoder.begin_group :string if state == :attribute_value_string
8991

@@ -237,6 +239,7 @@ def scan_tokens encoder, options
237239
if options[:keep_state]
238240
@state = state
239241
@plain_string_content = plain_string_content
242+
@in_tag = in_tag
240243
end
241244

242245
encoder.end_group :string if state == :attribute_value_string

0 commit comments

Comments
 (0)