Module: Opal::Haml
- Defined in:
- lib/opal/haml.rb,
lib/opal/haml/builder.rb,
lib/opal/haml/version.rb,
lib/opal/haml/processor.rb
Defined Under Namespace
Classes: HamlProcessor, Processor
Constant Summary
collapse
- VERSION =
'0.4.0'
Class Method Summary
collapse
Class Method Details
.compile(source, file = '(haml)') ⇒ Object
8
9
10
|
# File 'lib/opal/haml.rb', line 8
def self.compile(source, file = '(haml)')
Opal.compile(compile_haml(source, file))
end
|
.compile_haml(source, file) ⇒ Object
12
13
14
15
16
|
# File 'lib/opal/haml.rb', line 12
def self.compile_haml(source, file)
haml = ::Haml::Engine.new(source, :ugly => true).precompiled
haml = haml.gsub('_hamlout.buffer', '_hamlout')
wrap(haml, file)
end
|
.wrap(haml, file) ⇒ Object
18
19
20
21
22
23
24
25
26
|
# File 'lib/opal/haml.rb', line 18
def self.wrap(haml, file)
" require 'opal-haml'\n Template.new('\#{file}') do |_hamlout|\n \#{haml}\n _hamlout.join\n end\n EOS\nend\n"
|