Markup engines are not a kind of chunk

This commit is contained in:
Alexey Verkhovsky 2005-08-02 00:59:12 +00:00
parent 0d1c92a988
commit 6a9cc87536

View file

@ -9,12 +9,12 @@ require 'chunks/chunk'
# or RDoc to convert text. This markup occurs when the chunk is required # or RDoc to convert text. This markup occurs when the chunk is required
# to mask itself. # to mask itself.
module Engines module Engines
class AbstractEngine < Chunk::Abstract class AbstractEngine
# Create a new chunk for the whole content and replace it with its mask. # Convert content to HTML
def self.apply_to(content) def self.apply_to(content)
new_chunk = self.new(content) engine = self.new(content)
content.replace(new_chunk.mask) content.replace(engine.to_html)
end end
private private
@ -27,7 +27,7 @@ module Engines
end end
class Textile < AbstractEngine class Textile < AbstractEngine
def mask def to_html
redcloth = RedCloth.new(@content, [:hard_breaks] + @content.options[:engine_opts]) redcloth = RedCloth.new(@content, [:hard_breaks] + @content.options[:engine_opts])
redcloth.filter_html = false redcloth.filter_html = false
redcloth.no_span_caps = false redcloth.no_span_caps = false
@ -36,13 +36,13 @@ module Engines
end end
class Markdown < AbstractEngine class Markdown < AbstractEngine
def mask def to_html
BlueCloth.new(@content, @content.options[:engine_opts]).to_html BlueCloth.new(@content, @content.options[:engine_opts]).to_html
end end
end end
class Mixed < AbstractEngine class Mixed < AbstractEngine
def mask def to_html
redcloth = RedCloth.new(@content, @content.options[:engine_opts]) redcloth = RedCloth.new(@content, @content.options[:engine_opts])
redcloth.filter_html = false redcloth.filter_html = false
redcloth.no_span_caps = false redcloth.no_span_caps = false
@ -51,7 +51,7 @@ module Engines
end end
class RDoc < AbstractEngine class RDoc < AbstractEngine
def mask def to_html
RDocSupport::RDocFormatter.new(@content).to_html RDocSupport::RDocFormatter.new(@content).to_html
end end
end end