Class: Hikkoshi::Jekyll::Exporter

Inherits:
Exporter
  • Object
show all
Defined in:
lib/hikkoshi/jekyll/exporter.rb

Overview

Examples:

Basic Usage

posts = Hikkoshi::Logdown::Importer.new("~/blog-backup/")
exporter = Hikkoshi::Jekyll::Exporter.new(posts)
exporter.export("~/new-blog/_posts")

Customize file name

posts = Hikkoshi::Logdown::Importer.new("~/blog-backup/")
exporter = Hikkoshi::Jekyll::Exporter.new(posts)
exporter.filename_formatter = -> (post) {
  "#{post.date.strftime('%F')}-#{post.slug}.md"
}
exporter.export("~/new-blog/_posts")

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#filename_formatter(post) ⇒ Object

Override this method to customize file name format



27
28
29
# File 'lib/hikkoshi/jekyll/exporter.rb', line 27

def filename_formatter
  @filename_formatter
end

Instance Method Details

#export(path) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/hikkoshi/jekyll/exporter.rb', line 18

def export(path)
  path = File.expand_path(path)

  @posts.each do |post|
    generate_post(post, path)
  end
end