lib/deface/dsl/loader.rb in deface-0.9.1 vs lib/deface/dsl/loader.rb in deface-1.0.0.rc1
- old
+ new
@@ -34,11 +34,11 @@
context_name = context_name.gsub('.html.haml', '')
context = Context.new(context_name)
context.virtual_path(determine_virtual_path(filename))
context.instance_eval(dsl_commands)
context.haml(the_rest)
- context.create_override
+ context.create_override
else
context = Context.new(context_name)
context.virtual_path(determine_virtual_path(filename))
context.instance_eval(file_contents)
context.create_override
@@ -59,10 +59,13 @@
unless first_close_comment_index.nil?
comment = html_file_contents[first_open_comment_index..first_close_comment_index+2]
end
- dsl_commands << comment.gsub('<!--', '').gsub('-->', '').strip + "\n"
+ comment.gsub('<!--', '').gsub('-->', '').strip.scan(/[^\s"']+|"[^"]*"|'[^']*'/).each do |part|
+ dsl_commands =~ /('|")\z/ || part =~ /\w\z/ ? dsl_commands << "\n" : dsl_commands << ' '
+ dsl_commands << part
+ end
html_file_contents = html_file_contents.gsub(comment, '')
end
[dsl_commands, html_file_contents]