class Rote::Filters::BlueCloth

Page filter that converts markdown formatting to HTML using BlueCloth.

Public Class Methods

new(*restrictions, &blk) click to toggle source

Create a new filter instance. The supplied restrictions (if any) are passed directly to BlueCloth. See BlueCloth docs for details of supported restrictions.

If a block is supplied, it will be passed the BlueCloth string at render time, along with the page being rendered. It is expected to return the rendered content. If no block is supplied, to_html is called implicitly.

# File lib/rote/filters/bluecloth.rb, line 27
def initialize(*restrictions, &blk)
  super()  
  @restrictions = restrictions
  @blk = blk || lambda { |bc, page| bc.to_html }
end

Public Instance Methods

handler(text,page) click to toggle source
# File lib/rote/filters/bluecloth.rb, line 33
def handler(text,page)
  bc = ::BlueCloth.new(text)
  @blk.call(bc, page)
end