lib/troy/helpers.rb in troy-0.0.26 vs lib/troy/helpers.rb in troy-0.0.27

- old
+ new

@@ -2,12 +2,18 @@ module Helpers def h(content) CGI.escapeHTML(content) end + def t(*args) + I18n.t(*args) + end + def partial(name, locals = {}) path = site.root.join("partials/_#{name}.erb") EmbeddedRuby.new(path.read, locals.merge(site: site)).render + rescue Exception, StandardError => error + raise "Unable to render #{path}; #{error.message}" end def inline_file(path) site.root.join(path).read end