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 46 47 48 |
# File 'lib/intranet/core/haml_wrapper.rb', line 40 def to_markup(template, content = {}) opts = { escape_html: false } engine = Haml::Template.new(opts) do File.read(find_template(template)) end engine.render(self, content) rescue Errno::ENOENT # template file does not exists '' end |