We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It would be nice if there was support for Rails' String#html_safe to be treated the same way as Handlebars::SafeString.
The text was updated successfully, but these errors were encountered:
i also wanted this because i'm trying to share data between the frontend and these handlebars templates.
In my rails app i created initializers/handlebars.rb(a dirty monkeypatch, i know)
initializers/handlebars.rb
module Handlebars class SafeString def self.new(string) if context = Context.current context.handlebars['SafeString'].new(string) else string.html_safe end end end end
then with the data:
def procs_to_html_safe(data) data.each_with_object({}){|(k, v), result| (v.class.to_s == 'Proc') ? result[k] = v.call : result[k] = v} end
Sorry, something went wrong.
No branches or pull requests
It would be nice if there was support for Rails' String#html_safe to be treated the same way as Handlebars::SafeString.
The text was updated successfully, but these errors were encountered: