Sha256: 091aadf0b641ab7309a31517284524e372407721059fe8706fce151f2485d033
Contents?: true
Size: 912 Bytes
Versions: 12
Compression:
Stored size: 912 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 # The path to the draft source file, relative to the site source def relative_path File.join(@dir, '_drafts', @name) 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
12 entries across 12 versions & 1 rubygems