class Jekyll::Tags::PostComparer

def ==(other)

def ==(other)
  other.relative_path.match(@name_regex)
end

def deprecated_equality(other)

def deprecated_equality(other)
  slug == post_slug(other) &&
    post_date.year  == other.date.year &&
    post_date.month == other.date.month &&
    post_date.day   == other.date.day
end

def initialize(name)

def initialize(name)
  @name = name
  all, @path, @date, @slug = *name.sub(%r!^/!, "").match(MATCHER)
  unless all
    raise Jekyll::Errors::InvalidPostNameError,
          "'#{name}' does not contain valid date and/or title."
  end
  basename_pattern = "#{date}-#{Regexp.escape(slug)}\\.[^.]+"
  @name_regex = %r!^_posts/#{path}#{basename_pattern}|^#{path}_posts/?#{basename_pattern}!
end

def post_date

def post_date
  @post_date ||= Utils.parse_date(
    date,
    "'#{date}' does not contain valid date and/or title."
  )
end

def post_slug(other)

Returns the post slug with the subdirectory (relative to _posts)

other - the Jekyll::Post

Construct the directory-aware post slug for a Jekyll::Post
def post_slug(other)
  path = other.basename.split("/")[0...-1].join("/")
  if path.nil? || path == ""
    other.data["slug"]
  else
    "#{path}/#{other.data["slug"]}"
  end
end