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
challah-0.3.5 vendor/bundle/gems/tilt-1.3.3/lib/tilt/wiki.rb
challah-0.3.4 vendor/bundle/gems/tilt-1.3.3/lib/tilt/wiki.rb
challah-0.3.3 vendor/bundle/gems/tilt-1.3.3/lib/tilt/wiki.rb
challah-0.3.2 vendor/bundle/gems/tilt-1.3.3/lib/tilt/wiki.rb
challah-0.3.1 vendor/bundle/gems/tilt-1.3.3/lib/tilt/wiki.rb
challah-0.3.0 vendor/bundle/gems/tilt-1.3.3/lib/tilt/wiki.rb
challah-0.2.1 vendor/bundle/gems/tilt-1.3.3/lib/tilt/wiki.rb
challah-0.2.0 vendor/bundle/gems/tilt-1.3.3/lib/tilt/wiki.rb
tilt-1.3.3 lib/tilt/wiki.rb