Class: Blogdown::Publisher
- Inherits:
-
Object
- Object
- Blogdown::Publisher
- Defined in:
- lib/blogdown/publisher.rb
Instance Method Summary collapse
- #clean_output ⇒ Object
- #compose ⇒ Object
- #file_stack ⇒ Object
-
#initialize(root) ⇒ Publisher
constructor
A new instance of Publisher.
- #kramdown_options ⇒ Object
- #transform(txt) ⇒ Object
Constructor Details
Instance Method Details
#clean_output ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/blogdown/publisher.rb', line 32 def clean_output base_root=@base+'/output' base_root=Pathname base_root if base_root.exist? base_root.rmtree base_root.mkpath else base_root.mkpath end end |
#compose ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/blogdown/publisher.rb', line 11 def compose clean_output if @pipeline.stack.empty? raise IOError, "No file to compose" else @pipeline.stack.each do |file| htm=transform(file.read) @pipeline.writer(file.basename,htm) end end end |
#file_stack ⇒ Object
28 29 30 |
# File 'lib/blogdown/publisher.rb', line 28 def file_stack @pipeline.stack end |
#kramdown_options ⇒ Object
43 44 45 |
# File 'lib/blogdown/publisher.rb', line 43 def {coderay_css: "style", coderay_line_numbers: nil} end |
#transform(txt) ⇒ Object
24 25 26 |
# File 'lib/blogdown/publisher.rb', line 24 def transform(txt) Kramdown::Document.new(txt,).to_html end |