haml-edge 2.3.68 → 2.3.69

Sign up to get free protection for your applications and to get access to all the features.
data/EDGE_GEM_VERSION CHANGED
@@ -1 +1 @@
1
- 2.3.68
1
+ 2.3.69
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.3.68
1
+ 2.3.69
@@ -306,15 +306,23 @@ END
306
306
  def flush_merged_text
307
307
  return if @to_merge.empty?
308
308
 
309
- text, tab_change = @to_merge.inject(["", 0]) do |(str, mtabs), (type, val, tabs)|
309
+ str = ""
310
+ mtabs = 0
311
+ newlines = 0
312
+ @to_merge.each do |type, val, tabs|
310
313
  case type
311
314
  when :text
312
- [str << val.inspect[1...-1], mtabs + tabs]
315
+ str << val.inspect[1...-1]
316
+ mtabs += tabs
313
317
  when :script
314
318
  if mtabs != 0 && !@options[:ugly]
315
319
  val = "_hamlout.adjust_tabs(#{mtabs}); " + val
316
320
  end
317
- [str << "\#{#{val}}", 0]
321
+ str << "\#{#{"\n" * newlines}#{val}}"
322
+ mtabs = 0
323
+ newlines = 0
324
+ when :newlines
325
+ newlines += val
318
326
  else
319
327
  raise SyntaxError.new("[HAML BUG] Undefined entry in Haml::Precompiler@to_merge.")
320
328
  end
@@ -322,10 +330,11 @@ END
322
330
 
323
331
  @precompiled <<
324
332
  if @options[:ugly]
325
- "_hamlout.buffer << \"#{text}\";"
333
+ "_hamlout.buffer << \"#{str}\";"
326
334
  else
327
- "_hamlout.push_text(\"#{text}\", #{tab_change}, #{@dont_tab_up_next_text.inspect});"
335
+ "_hamlout.push_text(\"#{str}\", #{mtabs}, #{@dont_tab_up_next_text.inspect});"
328
336
  end
337
+ @precompiled << "\n" * newlines
329
338
  @to_merge = []
330
339
  @dont_tab_up_next_text = false
331
340
  end
@@ -1008,8 +1017,7 @@ END
1008
1017
 
1009
1018
  def resolve_newlines
1010
1019
  return unless @newlines > 0
1011
- flush_merged_text unless @to_merge.all? {|type, *_| type == :text}
1012
- @precompiled << "\n" * @newlines
1020
+ @to_merge << [:newlines, @newlines]
1013
1021
  @newlines = 0
1014
1022
  end
1015
1023
 
@@ -1033,6 +1041,8 @@ END
1033
1041
  when :script
1034
1042
  last[1].gsub!(/\(haml_temp, (.*?)\);$/, '(haml_temp.rstrip, \1);')
1035
1043
  rstrip_buffer! index - 1
1044
+ when :newlines
1045
+ rstrip_buffer! index - 1
1036
1046
  else
1037
1047
  raise SyntaxError.new("[HAML BUG] Undefined entry in Haml::Precompiler@to_merge.")
1038
1048
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: haml-edge
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.68
4
+ version: 2.3.69
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Weizenbaum
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-11-03 00:00:00 -05:00
13
+ date: 2009-11-04 00:00:00 -05:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency