File tree Expand file tree Collapse file tree 3 files changed +23
-8
lines changed Expand file tree Collapse file tree 3 files changed +23
-8
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,14 @@ p=. _This files lists all changes in the CodeRay library since the 0.9.8 release
4
4
5
5
{{toc}}
6
6
7
+ h2. Changes in 1.0.4
8
+
9
+ Fixes in the CSS scanner:
10
+
11
+ * understands the unit "s" (seconds)
12
+ * ignores unexpected curly braces
13
+ * code inside of diffs is highlighted correctly
14
+
7
15
h2. Changes in 1.0.3
8
16
9
17
New:
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ module RE # :nodoc:
35
35
36
36
reldimensions = %w[ em ex px ]
37
37
absdimensions = %w[ in cm mm pt pc ]
38
- Unit = Regexp . union ( *( reldimensions + absdimensions ) )
38
+ Unit = Regexp . union ( *( reldimensions + absdimensions + %w[ s ] ) )
39
39
40
40
Dimension = /#{ Num } #{ Unit } /
41
41
@@ -50,10 +50,14 @@ module RE # :nodoc:
50
50
51
51
protected
52
52
53
+ def setup
54
+ @state = :initial
55
+ @value_expected = nil
56
+ end
57
+
53
58
def scan_tokens encoder , options
54
-
55
- value_expected = nil
56
- states = [ :initial ]
59
+ states = Array ( options [ :state ] || @state )
60
+ value_expected = @value_expected
57
61
58
62
until eos?
59
63
@@ -127,11 +131,9 @@ def scan_tokens encoder, options
127
131
128
132
elsif match = scan ( /\} / )
129
133
value_expected = false
134
+ encoder . text_token match , :operator
130
135
if states . last == :block || states . last == :media
131
- encoder . text_token match , :operator
132
136
states . pop
133
- else
134
- encoder . text_token match , :error
135
137
end
136
138
137
139
elsif match = scan ( /#{ RE ::String } /o )
@@ -183,6 +185,11 @@ def scan_tokens encoder, options
183
185
184
186
end
185
187
188
+ if options [ :keep_state ]
189
+ @state = states
190
+ @value_expected = value_expected
191
+ end
192
+
186
193
encoder
187
194
end
188
195
Original file line number Diff line number Diff line change 1
1
module CodeRay
2
- VERSION = '1.0.3 '
2
+ VERSION = '1.0.4 '
3
3
end
You can’t perform that action at this time.
0 commit comments