Sha256: 22b7fa573f0a419dd4bab1b06c9d94ddef2c8b32775edf45486b91240aac7c6c
Contents?: true
Size: 544 Bytes
Versions: 3
Compression:
Stored size: 544 Bytes
Contents
require "json" module Harp2Hugo class Converter def initialize input_file @data_json = JSON.parse(File.read input_file) end def convert output_dir @data_json.delete("feed") Dir.mkdir(output_dir) unless Dir.exist? output_dir @data_json.each { |key, value| post_content = File.read("#{key}.md") File.open("#{output_dir}/#{key}.md", 'w') { |output_file| output_file.write MetaData.new(value).to_yaml output_file.write post_content } } end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
harp2hugo-0.0.4 | lib/harp2hugo/converter.rb |
harp2hugo-0.0.3 | lib/harp2hugo/converter.rb |
harp2hugo-0.0.2 | lib/harp2hugo/converter.rb |