Skip to content
Permalink
Browse files

Merge pull request #1435 from namusyaka/fix-slim

Fix broken slim templates.
  • Loading branch information...
ujifgc committed Oct 7, 2013
2 parents 1eef86b + 1936238 commit 7b838f089bbdc417100d73bc3e0353738b8a9ce4
Showing with 11 additions and 0 deletions.
  1. +11 −0 padrino-core/lib/padrino-core/application/rendering/extensions/slim.rb
@@ -8,6 +8,17 @@

class Slim::Template
include Padrino::Rendering::SafeTemplate

def precompiled_preamble(locals)
result = locals.map do |k,v|
if k.to_s =~ /\A[a-z_][a-zA-Z_0-9]*\z/
"#{k} = locals[#{k.inspect}]"
else
raise "invalid locals key: #{k.inspect} (keys must be variable names)"
end
end.join("\n")
"#{result}; __in_erb_template = true;"
end
end
end
rescue LoadError

0 comments on commit 7b838f0

Please sign in to comment.
You can’t perform that action at this time.