10000 tweak HTML CDATA token kinds · tricknotes/coderay@14f3a4f · GitHub
[go: up one dir, main page]

Skip to content

Commit 14f3a4f

Browse files
committed
tweak HTML CDATA token kinds
1 parent 1d445c7 commit 14f3a4f

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

lib/coderay/scanners/html.rb

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
module CodeRay
22
module Scanners
3-
3+
44
# HTML Scanner
55
#
66
# Alias: +xhtml+
77
#
88
# See also: Scanners::XML
99
class HTML < Scanner
10-
10+
1111
register_for :html
1212

1313
KINDS_NOT_LOC = [
@@ -100,15 +100,13 @@ def scan_tokens encoder, options
100100

101101
when :initial
102102
if match = scan(/<!\[CDATA\[/)
103-
encoder.begin_group :string
104-
encoder.text_token match, :delimiter
103+
encoder.text_token match, :inline_delimiter
105104
if match = scan(/.*?\]\]>/m)
106-
encoder.text_token match[0..-4], :content
107-
encoder.text_token ']]>', :delimiter
108-
else
109-
encoder.text_token scan(/.*/m), :error
105+
encoder.text_token match[0..-4], :plain
106+
encoder.text_token ']]>', :inline_delimiter
107+
elsif match = scan(/.+/)
108+
encoder.text_token match, :error
110109
end
111-
encoder.end_group :string
112110
elsif match = scan(/<!--(?:.*?-->|.*)/m)
113111
encoder.text_token match, :comment
114112
elsif match = scan(/<!(\w+)(?:.*?>|.*)|\]>/m)

0 commit comments

Comments
 (0)
0