Sha256: 594774b9f0dc5edbbe13f3888db2f533fcd97f8639c6653447f0555d600892d8

Contents?: true

Size: 1.07 KB

Versions: 129

Compression:

Stored size: 1.07 KB

Contents

require 'tilt/template'

module Tilt
  # Creole implementation. See:
  # http://www.wikicreole.org/
  class CreoleTemplate < Template
    def self.engine_initialized?
      defined? ::Creole
    end

    def initialize_engine
      require_template_library 'creole'
    end

    def prepare
      opts = {}
      [:allowed_schemes, :extensions, :no_escape].each do |k|
        opts[k] = options[k] if options[k]
      end
      @engine = Creole::Parser.new(data, opts)
      @output = nil
    end

    def evaluate(scope, locals, &block)
      @output ||= @engine.to_html
    end
  end

  # WikiCloth implementation. See:
  # http://redcloth.org/
  class WikiClothTemplate < Template
    def self.engine_initialized?
      defined? ::WikiCloth::Parser
    end

    def initialize_engine
      require_template_library 'wikicloth'
    end

    def prepare
      @parser = options.delete(:parser) || WikiCloth::Parser
      @engine = @parser.new options.merge(:data => data)
      @output = nil
    end

    def evaluate(scope, locals, &block)
      @output ||= @engine.to_html
    end
  end
end

Version data entries

129 entries across 112 versions & 18 rubygems

Version Path
classiccms-0.7.5 vendor/bundle/gems/tilt-1.3.3/lib/tilt/wiki.rb
classiccms-0.7.4 vendor/bundle/gems/tilt-1.3.3/lib/tilt/wiki.rb
classiccms-0.7.3 vendor/bundle/gems/tilt-1.3.3/lib/tilt/wiki.rb
active_mailer-0.0.10 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/tilt-1.3.3/lib/tilt/wiki.rb
judge-2.0.5 vendor/bundle/ruby/2.1.0/gems/tilt-1.3.3/lib/tilt/wiki.rb
classiccms-0.7.2 vendor/bundle/gems/tilt-1.3.3/lib/tilt/wiki.rb
classiccms-0.7.1 vendor/bundle/gems/tilt-1.3.3/lib/tilt/wiki.rb
active_mailer-0.0.9 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/tilt-1.3.3/lib/tilt/wiki.rb
active_mailer-0.0.8 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/tilt-1.3.3/lib/tilt/wiki.rb
active_mailer-0.0.7 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/tilt-1.3.3/lib/tilt/wiki.rb
active_mailer-0.0.6 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/tilt-1.3.3/lib/tilt/wiki.rb
classiccms-0.7.0 vendor/bundle/gems/tilt-1.3.3/lib/tilt/wiki.rb
challah-1.0.0.beta vendor/bundle/gems/tilt-1.3.3/lib/tilt/wiki.rb
active_mailer-0.0.5 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/tilt-1.3.3/lib/tilt/wiki.rb
active_mailer-0.0.4 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/tilt-1.3.3/lib/tilt/wiki.rb
active_mailer-0.0.3 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/tilt-1.3.3/lib/tilt/wiki.rb
graphael-on-rails-0.5.1 vendor/bundle/gems/tilt-1.3.3/lib/tilt/wiki.rb
graphael-on-rails-0.0.1 vendor/bundle/gems/tilt-1.3.3/lib/tilt/wiki.rb
challah-0.9.1.beta.3 vendor/bundle/gems/tilt-1.3.3/lib/tilt/wiki.rb
devise_sociable-0.1.0 vendor/bundle/gems/tilt-1.3.3/lib/tilt/wiki.rb