lib/malt/formats/rbhtml.rb in malt-0.3.0 vs lib/malt/formats/rbhtml.rb in malt-0.4.0
- old
+ new
@@ -6,12 +6,31 @@
module Malt::Format
# RBHTML is a variant of Tenjin, but limited to HTML conversion.
class RBHTML < Abstract
- register 'rbhtml'
+ file_extension 'rbhtml'
+ #
+ def html(*data, &content)
+ render_into(:html, *data, &content)
+ end
+
+ #
+ def to_html(*data, &yld)
+ text = html(*data, &yld)
+ opts = options.merge(
+ :text => text,
+ :file => refile(:html),
+ :type => :html,
+ :engine => nil
+ )
+ HTML.new(opts)
+ end
+
+ # TODO: to_rb
+=begin
# RHTML templates can be "pre-compiled" into Ruby templates.
def rb(*)
render_engine.compile(:text=>text, :file=>file)
end
@@ -24,28 +43,17 @@
#
alias_method(:to_ruby, :to_rb)
#
alias_method(:precompile, :to_rb)
+=end
- #
- 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
+ #private
+ #
+ # #
+ # def render_engine
+ # @render_engine ||= Malt::Engine::Tenjin.new(options)
+ # end
end
end