Sha256: d7187d1ec61472e525e50e57d427521001f2e73b36a42a837b7681d2fc403dc8
Contents?: true
Size: 772 Bytes
Versions: 25
Compression:
Stored size: 772 Bytes
Contents
module Jekyll class Draft < Post # Valid post name regex (no date) 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 # Get the full path to the directory containing the draft files def containing_dir(source, dir) File.join(source, dir, '_drafts') end # Extract information from the post filename. # # name - The String filename of the post file. # # Returns nothing. def process(name) m, slug, ext = *name.match(MATCHER) self.date = File.mtime(File.join(@base, name)) self.slug = slug self.ext = ext end end end
Version data entries
25 entries across 25 versions & 2 rubygems