Sha256: 6be022f3f9e2c57c6171efd14b1190eddbe6f00c791577482991409d9dc281ad
Contents?: true
Size: 591 Bytes
Versions: 1
Compression:
Stored size: 591 Bytes
Contents
require 'yaml' module WP2Middleman class Frontmatter def initialize(post, include_fields: []) @post = post @include_fields = include_fields end def post_data data = { 'title' => post.title, 'date' => post.date_time_published, 'tags' => post.tags } data['published'] = false if !post.published? include_fields.each do |field| data[field] = post.field(field) end data end def to_yaml post_data.to_yaml.strip end private attr_reader :post, :include_fields end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
wp2middleman-0.0.3 | lib/wp2middleman/frontmatter.rb |