Sha256: 47a74ee0ec5e47bd5c6273476b8bfe90d0e238099055e6a9c1a99545889931a5
Contents?: true
Size: 1.86 KB
Versions: 6
Compression:
Stored size: 1.86 KB
Contents
module Spontaneous::Output::Template class PublishEngine # Should be initialized with the Site template roots def initialize(template_roots, cache = Spontaneous::Output.cache_templates?) @engine = template_engine_class(cache).new(template_roots, syntax) # disabled until I figure out where to write compiled scripts when using a # non-File based template store self.write_compiled_scripts = false # Spontaneous::Output.write_compiled_scripts? end def write_compiled_scripts=(state) @engine.write_compiled_scripts = state if @engine.respond_to?(:write_compiled_scripts=) end def syntax PublishSyntax end def roots @engine.roots end def render(content, context, format = :html) render_template(template_path(content, format), context, format) end def render_template(template_path, context, format = :html) @engine.render(template_path, context, format) end def render_string(template_string, context, format = :html) @engine.render_string(template_string, context, format) end def template_path(content, format) content.template(format, self) end def template_exists?(template, format) @engine.template_exists?(template, format) end def template_location(template, format) @engine.template_location(template, format) end def template_engine_class(cache) ::Spontaneous::Output.template_engine_class(cache) end def dynamic_template?(template_string) @engine.dynamic_template?(template_string) end end # Should be initialized with the path to the current rendered revision class RequestEngine < PublishEngine def syntax RequestSyntax end def template_path(content, format) path = content.path.gsub(%r{^/}, "") path = "index" if path.empty? path end end end
Version data entries
6 entries across 6 versions & 1 rubygems