Module: Intranet::Core::HamlWrapper
- Defined in:
- lib/intranet/core/haml_wrapper.rb
Overview
Wrapps the Haml engine from the Haml gem. This module has to be included in any class wanting to generate a HTML/XML from HAML templates.
Instance Method Summary collapse
-
#to_markup(template, content = {}) ⇒ String
Generate the HTML/XML from a given HAML template.
Instance Method Details
#to_markup(template, content = {}) ⇒ String
Generate the HTML/XML from a given HAML template.
40 41 42 43 44 45 |
# File 'lib/intranet/core/haml_wrapper.rb', line 40 def to_markup(template, content = {}) fd = File.read(find_template(template)) Haml::Engine.new(fd, escape_html: false).render(self, content) rescue Errno::ENOENT # template file does not exists '' end |