class JekyllImport::Importers::WordpressDotCom::Item

Public Class Methods

new(node) click to toggle source
# File lib/jekyll-import/importers/wordpressdotcom.rb, line 56
def initialize(node)
  @node = node
end

Public Instance Methods

directory_name() click to toggle source
# File lib/jekyll-import/importers/wordpressdotcom.rb, line 116
def directory_name
  @directory_name ||= if !published? && post_type == "post"
                        "_drafts"
                      else
                        "_#{post_type}s"
                      end
end
excerpt() click to toggle source
# File lib/jekyll-import/importers/wordpressdotcom.rb, line 128
def excerpt
  @excerpt ||= begin
    text = Hpricot(text_for("excerpt:encoded")).inner_text
    if text.empty?
      nil
    else
      text
    end
  end
end
file_name() click to toggle source
# File lib/jekyll-import/importers/wordpressdotcom.rb, line 108
def file_name
  @file_name ||= if published?
                   "#{published_at.strftime("%Y-%m-%d")}-#{permalink_title}.html"
                 else
                   "#{permalink_title}.html"
                 end
end
parent_id() click to toggle source
# File lib/jekyll-import/importers/wordpressdotcom.rb, line 104
def parent_id
  @parent_id ||= text_for("wp:post_parent")
end
post_password() click to toggle source
# File lib/jekyll-import/importers/wordpressdotcom.rb, line 96
def post_password
  @post_password ||= text_for("wp:post_password")
end
post_type() click to toggle source
# File lib/jekyll-import/importers/wordpressdotcom.rb, line 100
def post_type
  @post_type ||= text_for("wp:post_type")
end
published?() click to toggle source
# File lib/jekyll-import/importers/wordpressdotcom.rb, line 124
def published?
  @published ||= (status == "publish")
end
published_at() click to toggle source
# File lib/jekyll-import/importers/wordpressdotcom.rb, line 88
def published_at
  @published_at ||= Time.parse(text_for("wp:post_date")) if published?
end
status() click to toggle source
# File lib/jekyll-import/importers/wordpressdotcom.rb, line 92
def status
  @status ||= text_for("wp:status")
end
text_for(path) click to toggle source
# File lib/jekyll-import/importers/wordpressdotcom.rb, line 60
def text_for(path)
  @node.at(path).inner_text
end
title() click to toggle source
# File lib/jekyll-import/importers/wordpressdotcom.rb, line 64
def title
  @title ||= text_for(:title).strip
end