Sha256: 2941931b9f9f7990e8f629ea90393672b5f40400a0381c772b981e221fe7ef6c
Contents?: true
Size: 948 Bytes
Versions: 5
Compression:
Stored size: 948 Bytes
Contents
require 'coderay' require 'kramdown' module Blogdown class Publisher def initialize root @pipeline=Blogdown::FilePipeline.new root @base=root end 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 def transform(txt) Kramdown::Document.new(txt,kramdown_options).to_html end def file_stack @pipeline.stack end 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 def kramdown_options {coderay_css: "style", coderay_line_numbers: nil} end end end
Version data entries
5 entries across 5 versions & 1 rubygems