Closed snowmac closed 8 years ago
It'd be based on what kind of things you're passing by partial
, self
and options
. For most cases, especially for non-rails environment, you want Hamlit::Template
.
[1] pry(main)> partial = ".foo\n = b + c"
=> ".foo\n = b + c"
[2] pry(main)> def b; 'hello '; end
=> :b
[3] pry(main)> Haml::Engine.new(partial, ugly: true, attr_wrapper: '"').render(self, c: 'world')
=> "<div class=\"foo\">\nhello world\n</div>\n"
[4] pry(main)> Hamlit::Template.new(attr_quote: '"') { partial }.render(self, c: 'world')
=> "<div class=\"foo\">\nhello world\n</div>\n"
Thank you. Doing that as a template renders it as a html string, but when I render it to the browser, its a string of html not the ui view. How do I fix that?
I couldn't understand what you mean and want to do. If you're building web app, what framework do you use?
See https://github.com/k0kubun/hamlit/blob/master/REFERENCE.md for Rails or Sinatra. Otherwise, you should use Tilt interface.
when I render it to the browser, its a string of html not the ui view
I guess there're two possibilities.
Hamlit::Template.new(escape_html: false) { partial }.render(self, {})
Closing for now. Feel free to reopen this issue if you still have a problem.
So I need to render a parital and the code I use to generate the HTML when it's the Haml engine is:
What would be the code for Hamlit?