jeanny 0.99.4 → 0.99.5

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.
Files changed (2) hide show
  1. data/lib/jeanny/engine.rb +9 -21
  2. metadata +2 -2
data/lib/jeanny/engine.rb CHANGED
@@ -222,30 +222,21 @@ module Jeanny
222
222
 
223
223
  def replace classes
224
224
 
225
- data = []
226
- each_string do |value, quote|
227
-
228
- next unless value.length > 4
229
- meat = value.dup
230
-
225
+ strings = Array.new
226
+ each_string do |string|
227
+ after = string.dup
231
228
  classes.each do |full_class, short_class|
232
- while pos = meat =~ /([^#]|^)#{full_class}(?=[^a-z0-9\-_\.\/]|$)/i
229
+ while pos = after =~ /([^#]|^)#{full_class}(?=[^a-z0-9\-_\.\/]|$)/i
233
230
  if $1.nil? or $1.empty?
234
- meat[pos, full_class.length] = short_class
231
+ after[pos, full_class.length] = short_class
235
232
  else
236
- meat[pos + 1, full_class.length] = short_class
233
+ after[pos + 1, full_class.length] = short_class
237
234
  end
238
235
  end
239
236
  end
237
+
238
+ @code[@code.index(string), string.length] = after unless string.eql? after
240
239
 
241
- unless meat.eql? value
242
- data.push [ "#{quote}#{value}#{quote}", "#{quote}#{meat}#{quote}" ]
243
- end
244
-
245
- end
246
-
247
- data.each do |string|
248
- @code.gsub! /#{string.first}/, string.last
249
240
  end
250
241
 
251
242
  @code
@@ -293,12 +284,9 @@ module Jeanny
293
284
  # Если мы в строке (или регулярке), текущий символ такой же как и начальный,
294
285
  # а предыдущий не экранирует его, значит строка законченна.
295
286
  # Переходим в режим "в коде"
296
- # if @char.eql? @start_char and scanner.pre_match !~ /[^\\]\\$/
297
287
  if @char.eql? @start_char and not @last_char.eql? '\\'
298
288
  if block_given?
299
- # yield "#{@start_char}#{@value}#{@start_char}", @value
300
- # yield @value
301
- yield @value, @start_char
289
+ yield "#{@start_char}#{@value}#{@start_char}"
302
290
  end
303
291
 
304
292
  @status, @start_char, @value = :in_code, '', ''
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jeanny
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.99.4
4
+ version: 0.99.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - gfranco
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-03-23 00:00:00 +03:00
12
+ date: 2010-03-31 00:00:00 +03:00
13
13
  default_executable:
14
14
  dependencies: []
15
15