Module: Awestruct::Blueclothable

Included in:
MarukuFile
Defined in:
lib/awestruct/blueclothable.rb

Instance Method Summary collapse

Instance Method Details

#contentObject



24
25
26
27
# File 'lib/awestruct/blueclothable.rb', line 24

def content
  context = site.engine.create_context( self )
  render( context )
end

#render(context) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/awestruct/blueclothable.rb', line 6

def render(context)
  rendered = ''
  begin
    bluecloth_options = { :smartypants => true }

    unless self.options.nil?
      bluecloth_options.merge!({ :smartypants => false }) if self.options[:html_entities] == false
    end

    doc = BlueCloth.new( context.interpolate_string( raw_page_content ), bluecloth_options )
    rendered = doc.to_html
  rescue => e
    puts e
    puts e.backtrace
  end
  rendered
end