implement and use Draft.valid?
This commit is contained in:
parent
1ac46b17c4
commit
642349f797
|
|
@ -5,6 +5,14 @@ module Jekyll
|
||||||
# Valid post name regex (no date)
|
# Valid post name regex (no date)
|
||||||
MATCHER = /^(.*)(\.[^.]+)$/
|
MATCHER = /^(.*)(\.[^.]+)$/
|
||||||
|
|
||||||
|
# Draft name validator. Draft filenames must be like:
|
||||||
|
# my-awesome-post.textile
|
||||||
|
#
|
||||||
|
# Returns true if valid, false if not.
|
||||||
|
def self.valid?(name)
|
||||||
|
name =~ MATCHER
|
||||||
|
end
|
||||||
|
|
||||||
# Extract information from the post filename.
|
# Extract information from the post filename.
|
||||||
#
|
#
|
||||||
# name - The String filename of the post file.
|
# name - The String filename of the post file.
|
||||||
|
|
|
||||||
|
|
@ -212,7 +212,7 @@ module Jekyll
|
||||||
|
|
||||||
# first pass processes, but does not yet render post content
|
# first pass processes, but does not yet render post content
|
||||||
entries.each do |f|
|
entries.each do |f|
|
||||||
if Post.valid?(f)
|
if Draft.valid?(f)
|
||||||
post = Draft.new(self, self.source, dir, f)
|
post = Draft.new(self, self.source, dir, f)
|
||||||
|
|
||||||
if post.published && (self.future || post.date <= self.time)
|
if post.published && (self.future || post.date <= self.time)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue