Class: Rote::Filters::BlueCloth
- Inherits:
-
TextFilter
- Object
- TextFilter
- Rote::Filters::BlueCloth
- Defined in:
- lib/rote/filters/bluecloth.rb
Overview
Page filter that converts markdown formatting to HTML using BlueCloth.
Instance Attribute Summary
Attributes inherited from TextFilter
Instance Method Summary collapse
- #handler(text, page) ⇒ Object
-
#initialize(*restrictions, &blk) ⇒ BlueCloth
constructor
Create a new filter instance.
Methods inherited from TextFilter
Constructor Details
#initialize(*restrictions, &blk) ⇒ BlueCloth
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.
27 28 29 30 31 |
# File 'lib/rote/filters/bluecloth.rb', line 27 def initialize(*restrictions, &blk) super() @restrictions = restrictions @blk = blk || lambda { |bc, page| bc.to_html } end |
Instance Method Details
#handler(text, page) ⇒ Object
33 34 35 36 |
# File 'lib/rote/filters/bluecloth.rb', line 33 def handler(text,page) bc = ::BlueCloth.new(text) @blk.call(bc, page) end |