Sha256: fae5edc94b9bbdaa89d7c7adc155e3efca7b3f71ab990ad794285e4981d52bc1
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
require 'temple' require 'tilt' require 'fast_haml/filter_compilers/base' require 'fast_haml/text_compiler' module FastHaml module FilterCompilers class TiltBase < Base include Temple::Utils def self.render_with_tilt(name, source) ::Tilt["t.#{name}"].new { source }.render end protected def compile_with_tilt(name, texts) source = texts.join("\n") temple = [:multi, [:static, "\n"], [:newline]] if TextCompiler.contains_interpolation?(source) text_temple = [:multi] compile_texts(text_temple, texts) sym = unique_name temple << [:capture, sym, text_temple] temple << [:dynamic, "::FastHaml::FilterCompilers::TiltBase.render_with_tilt(#{name.inspect}, #{sym})"] temple << [:newline] else compiled = self.class.render_with_tilt(name, source) temple << [:static, compiled] temple.concat([[:newline]] * (texts.size - 1)) end temple end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fast_haml-0.1.9 | lib/fast_haml/filter_compilers/tilt_base.rb |