Sha256: fda04ea4b9a3d7309a421216a71997932eeedf33aecd79d6e8dcae6592a085de

Contents?: true

Size: 1.23 KB

Versions: 1

Compression:

Stored size: 1.23 KB

Contents

require 'rdocsupport'
require 'chunks/chunk'

# The markup engines are Chunks that call the one of RedCloth, BlueCloth
# or RDoc to convert text. This markup occurs when the chunk is required
# to mask itself.
module Engines
  class Textile < Chunk::Abstract
    def self.pattern() /^(.*)$/m end
    def mask(content)
      #RedCloth.new(text,content.options[:engine_opts]).to_html
      rc = RedCloth.new(text,content.options[:engine_opts])
      rc.rules = [:textile]
      rc.to_html
    end
    def unmask(content) self end
  end

  class Markdown < Chunk::Abstract
    def self.pattern() /^(.*)$/m end
    
    if RedCloth::VERSION >= '3.0.0'
      def mask(content)
        rc = RedCloth.new(text,content.options[:engine_opts])
        rc.rules = [:markdown]
        rc.to_html
      end
    else
      def mask(content)
        BlueCloth.new(text,content.options[:engine_opts]).to_html
      end
    end

    def unmask(content) self end
  end

  class RDoc < Chunk::Abstract
    def self.pattern() /^(.*)$/m end
    def mask(content)
      RDocSupport::RDocFormatter.new(text).to_html
    end
    def unmask(content) self end
  end

  MAP = { :textile => Textile, :markdown => Markdown, :rdoc => RDoc }
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
Pimki-1.3.092 app/models/chunks/engines.rb