Sha256: 3c43e12a9d95cd1a85c492197a3343fcfea8cec241abee57ae9fa97e785bad07
Contents?: true
Size: 1.05 KB
Versions: 3
Compression:
Stored size: 1.05 KB
Contents
require 'malt/formats/abstract' require 'malt/formats/html' require 'malt/engines/erb' require 'malt/engines/erubis' module Malt::Format # RBHTML is a variant of Tenjin, but limited to HTML conversion. class RBHTML < Abstract register 'rbhtml' # RHTML templates can be "pre-compiled" into Ruby templates. def rb(*) render_engine.compile(:text=>text, :file=>file) end # RHTML templates can be "pre-compiled" into Ruby templates. def to_rb(*) text = rb Ruby.new(:text=>text, :file=>refile(:rb), :type=>:rb) end # alias_method(:to_ruby, :to_rb) # alias_method(:precompile, :to_rb) # def html(data=nil, &yld) render_engine.render(:text=>text, :file=>file, :data=>data, :format=>:html, &yld) end # def to_html(data=nil, &yld) text = html(data, &yld) opts = options.merge(:text=>text, :file=>refile(:html), :type=>:html) HTML.new(opts) end private # def render_engine @render_engine ||= Malt::Engine::Tenjin.new(options) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
malt-0.3.0 | lib/malt/formats/rbhtml.rb |
malt-0.2.0 | lib/malt/formats/rbhtml.rb |
malt-0.1.1 | lib/malt/formats/rbhtml.rb |