Sha256: ce2e4d88612542498c7fadafbacf40d5a0b5b628d2e2e285087a02b9c88e5184
Contents?: true
Size: 1.02 KB
Versions: 3
Compression:
Stored size: 1.02 KB
Contents
begin require 'markaby' rescue LoadError puts "you must install the markaby gem to use .mab templates" end module Markaby class Builder def _buf; self end def throw_content(name, &block) @helpers.instance_variable_set "@_#{name}_content", eval("@_#{name}_content = (@_#{name}_content|| '') + capture(&block)") end end end module Merb module Template module Markaby ::Merb::Controller.register_engine self, %w[ mab ] class << self def exempt_from_layout? false end # OPTIMIZE : add mab template caching. what does this mean for mab? # mab is just ruby, there's no two phase compile and run def transform(options = {}) opts, file, view_context = options.values_at(:opts, :file, :view_context) mab = ::Markaby::Builder.new({}, view_context) { instance_eval(File.read(file)) } mab.to_s end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
merb-0.2.0 | lib/merb/template/markaby.rb |
merb-0.3.0 | lib/merb/template/markaby.rb |
merb-0.3.1 | lib/merb/template/markaby.rb |