Class: Rake::Pipeline::Web::Filters::MarkdownFilter
- Inherits:
-
Filter
- Object
- Filter
- Rake::Pipeline::Web::Filters::MarkdownFilter
- Defined in:
- lib/rake-pipeline-web-filters/markdown_filter.rb
Overview
A filter that compiles input files written in Markdown to Markdown using the Redcarpet compiler.
Instance Method Summary collapse
-
#generate_output(inputs, output) ⇒ Object
Implement the #generate_output method required by the Filter API.
-
#initialize(options = {}, &block) ⇒ MarkdownFilter
constructor
A new instance of MarkdownFilter.
Constructor Details
#initialize(options = {}, &block) ⇒ MarkdownFilter
Returns a new instance of MarkdownFilter.
30 31 32 33 34 35 |
# File 'lib/rake-pipeline-web-filters/markdown_filter.rb', line 30 def initialize(={}, &block) block ||= proc { |input| input.sub(/\.(md|mdown|mkdown|markdown)$/, '.html') } super(&block) @compiler = .delete(:compiler) @options = end |
Instance Method Details
#generate_output(inputs, output) ⇒ Object
Implement the #generate_output method required by the Filter API. Compiles each input file with Sass.
45 46 47 48 49 |
# File 'lib/rake-pipeline-web-filters/markdown_filter.rb', line 45 def generate_output(inputs, output) inputs.each do |input| output.write compile(input.read) end end |