Class: Nanoc3::Filters::RedCloth
- Inherits:
-
Nanoc3::Filter
- Object
- Context
- Nanoc3::Filter
- Nanoc3::Filters::RedCloth
- Defined in:
- lib/nanoc3/filters/redcloth.rb
Constant Summary
Constants inherited from Nanoc3::Filter
Nanoc3::Filter::TMP_BINARY_ITEMS_DIR
Instance Attribute Summary
Attributes inherited from Nanoc3::Filter
Instance Method Summary collapse
-
#run(content, params = {}) ⇒ String
Runs the content through [RedCloth](redcloth.org/).
Methods inherited from Nanoc3::Filter
#depend_on, #filename, from_binary?, #initialize, #output_filename, to_binary?, type
Methods included from PluginRegistry::PluginMethods
#identifier, #identifiers, #named, #register
Methods inherited from Context
Constructor Details
This class inherits a constructor from Nanoc3::Filter
Instance Method Details
#run(content, params = {}) ⇒ String
Runs the content through [RedCloth](redcloth.org/). This method takes the following options:
-
‘:filter_class`
-
‘:filter_html`
-
‘:filter_ids`
-
‘:filter_style`
-
‘:hard_breaks`
-
‘:lite_mode`
-
‘:no_span_caps`
-
‘:sanitize_htm`
Each of these options sets the corresponding attribute on the ‘RedCloth` instance. For example, when the `:hard_breaks => false` option is passed to this filter, the filter will call `r.hard_breaks = false` (with `r` being the `RedCloth` instance).
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/nanoc3/filters/redcloth.rb', line 28 def run(content, params={}) # Create formatter r = ::RedCloth.new(content) # Set options r.filter_classes = params[:filter_classes] if params.has_key?(:filter_classes) r.filter_html = params[:filter_html] if params.has_key?(:filter_html) r.filter_ids = params[:filter_ids] if params.has_key?(:filter_ids) r.filter_styles = params[:filter_styles] if params.has_key?(:filter_styles) r.hard_breaks = params[:hard_breaks] if params.has_key?(:hard_breaks) r.lite_mode = params[:lite_mode] if params.has_key?(:lite_mode) r.no_span_caps = params[:no_span_caps] if params.has_key?(:no_span_caps) r.sanitize_html = params[:sanitize_html] if params.has_key?(:sanitize_html) # Get result r.to_html end |