# File lib/haml/compiler.rb, line 16 def compile(node) parent = instance_variable_defined?('@node') ? @node : nil @node = node if node.children.empty? send(:"compile_#{node.type}") else send(:"compile_#{node.type}") {node.children.each {|c| compile c}} end ensure @node = parent end
The source code that is evaluated to produce the Haml document.
In Ruby 1.9, this is automatically converted to the correct encoding (see {file:REFERENCE.md#encodings the `:encoding` option}).
@return [String]
# File lib/haml/compiler.rb, line 35 def precompiled @precompiled end
# File lib/haml/template.rb, line 10 def precompiled_method_return_value_with_haml_xss "::Haml::Util.html_safe(#{precompiled_method_return_value_without_haml_xss})" end
Returns the precompiled string with the preamble and postamble.
Initializes to ActionView::OutputBuffer when available; this is necessary to avoid ordering issues with partial layouts in Rails. If not available, initializes to nil.
# File lib/haml/compiler.rb, line 55 def precompiled_with_ambles(local_names) preamble = beginextend Haml::Helpers_hamlout = @haml_buffer = Haml::Buffer.new(haml_buffer, #{options.for_buffer.inspect})_erbout = _hamlout.buffer@output_buffer = output_buffer ||= ActionView::OutputBuffer.new rescue nil.gsub("\n", ";") postamble = #{precompiled_method_return_value}ensure@haml_buffer = @haml_buffer.upper if @haml_bufferend.gsub("\n", ";") preamble + locals_code(local_names) + precompiled + postamble end
Generated with the Darkfish Rdoc Generator 2.