coderay 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -35,7 +35,7 @@ module Scanners
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 Scanners
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 @@ module Scanners
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 @@ module Scanners
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
 
@@ -1,3 +1,3 @@
1
1
  module CodeRay
2
- VERSION = '1.0.3'
2
+ VERSION = '1.0.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coderay
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-26 00:00:00.000000000Z
12
+ date: 2011-11-02 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Fast and easy syntax highlighting for selected languages, written in
15
15
  Ruby. Comes with RedCloth integration and LOC counter.