Sha256: ded2f4b687b884d16f87e61b3f5b16e07122f618b2406766a259afa2bc4b2d2d

Contents?: true

Size: 909 Bytes

Versions: 1

Compression:

Stored size: 909 Bytes

Contents

require 'malt/formats/abstract'
require 'malt/engines/redcloth'

module Malt::Formats
 
  #
  class Textile < Abstract

    register('textile', 'tt')

    #
    def html
      render_engine.render(:format=>:html, :text=>text, :file=>file)
    end

    #
    def textile
      text
    end

    #
    alias_method :tt, :textile

    #
    def to_html
      opts = options.merge(:text=>html, :file=>refile(:html), :type=>:html)
      HTML.new(opts)
    end

    #
    def to_textile
      self
    end

    alias_method :to_tt, :to_textile

    #
    #def render_to(to, *)
    #  case to
    #  when :textile, :tt
    #    self
    #  when :html
    #    malt_engine.render_html(text, file)
    #  else
    #    raise "can't render textile to #{to} type" #?
    #  end
    #end

    private

      #
      def render_engine
        @render_engine ||= Malt::Engines::RedCloth.new(options)
      end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
malt-0.1.0 lib/malt/formats/textile.rb