Sha256: 5f5822696f1740aed52b70dbc8a37a1e1d3c569885e13135498e3869fe444b92
Contents?: true
Size: 968 Bytes
Versions: 8
Compression:
Stored size: 968 Bytes
Contents
require 'temple' require 'tilt' require 'faml/filter_compilers/base' require 'faml/text_compiler' module Faml 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(temple, name, ast) source = ast.texts.join("\n") if TextCompiler.contains_interpolation?(source) text_temple = [:multi] compile_texts(text_temple, ast.lineno, ast.texts) sym = unique_name temple << [:capture, sym, text_temple] temple << [:dynamic, "::Faml::FilterCompilers::TiltBase.render_with_tilt(#{name.inspect}, #{sym})"] else compiled = self.class.render_with_tilt(name, source) temple << [:static, compiled] temple.concat([[:newline]] * (ast.texts.size - 1)) end temple end end end end
Version data entries
8 entries across 8 versions & 1 rubygems