Class: Propaganda::Formatter

Inherits:
Object
  • Object
show all
Defined in:
lib/propaganda/formatter.rb

Instance Method Summary collapse

Instance Method Details

#format(text, title = nil, engine = nil) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/propaganda/formatter.rb', line 6

def format(text, title=nil, engine=nil)
  case engine
    when 'markdown'
      text = BlueCloth.new(text).to_html
      text = layout(text, title)
    when 'textile'
      r = RedCloth.new(text)
      r.hard_breaks = false
      text = r.to_html
      text = layout(text, title)
    else
      text
  end        
end