Sha256: 5d92ba905e07b7145305bfefb7d7b1557e288017cae34a29ad9257aa892e4cfd

Contents?: true

Size: 967 Bytes

Versions: 2

Compression:

Stored size: 967 Bytes

Contents

require 'malt/formats/abstract'
require 'malt/formats/html'
require 'malt/engines/markaby'

module Malt::Format

  # Erecotr looks like a Markup format, but it is a template format
  # Much like pure Ruby too.
  class Markaby < Abstract

    register 'markaby', 'mab'

    #
    def markaby(*)
      text
    end

    #
    def to_markaby(*)
      self
    end

    #
    def html(data=nil, &yld)
      render_engine.render(:format=>:html, :text=>text, :file=>file, :data=>data, &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

    #
    #def to_ruby(db, &yld)
    #  @ruby ||= (
    #    source = engine.compile(text, file)
    #    Ruby.new(:text=>source, :file=>refile(:rb))
    #  )
    #end

    private

      #
      def render_engine
        @render_engine ||= Malt::Engine::Markaby.new(options)
      end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
malt-0.3.0 lib/malt/formats/markaby.rb
malt-0.2.0 lib/malt/formats/markaby.rb