Moving comparison for PostUrl tag to the PostComparer class
This commit is contained in:
parent
ba64a9fe30
commit
24aabbe05f
|
@ -10,6 +10,13 @@ module Jekyll
|
||||||
@slug = slug
|
@slug = slug
|
||||||
@date = Time.parse(date)
|
@date = Time.parse(date)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def ==(other)
|
||||||
|
slug == other.slug &&
|
||||||
|
date.year == other.date.year &&
|
||||||
|
date.month == other.date.month &&
|
||||||
|
date.day == other.date.day
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class PostUrl < Liquid::Tag
|
class PostUrl < Liquid::Tag
|
||||||
|
@ -23,11 +30,7 @@ module Jekyll
|
||||||
site = context.registers[:site]
|
site = context.registers[:site]
|
||||||
|
|
||||||
site.posts.each do |p|
|
site.posts.each do |p|
|
||||||
if p.slug == @post.slug \
|
if @post == p
|
||||||
and p.date.year == @post.date.year \
|
|
||||||
and p.date.month == @post.date.month \
|
|
||||||
and p.date.day == @post.date.day
|
|
||||||
|
|
||||||
return p.url
|
return p.url
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue