Class: Jekyll::Draft
Constant Summary collapse
- MATCHER =
Valid post name regex (no date)
/^(.*)(\.[^.]+)$/
Constants inherited from Post
Post::ATTRIBUTES_FOR_LIQUID, Post::EXCERPT_ATTRIBUTES_FOR_LIQUID
Instance Attribute Summary
Attributes inherited from Post
#categories, #content, #data, #date, #ext, #extracted_excerpt, #name, #output, #published, #site, #slug, #tags
Class Method Summary collapse
-
.valid?(name) ⇒ Boolean
Draft name validator.
Instance Method Summary collapse
-
#containing_dir(source, dir) ⇒ Object
Get the full path to the directory containing the draft files.
-
#process(name) ⇒ Object
Extract information from the post filename.
Methods inherited from Post
#<=>, #destination, #dir, #excerpt, #id, #initialize, #inspect, #next, #path, #permalink, #populate_categories, #populate_tags, #previous, #published?, #read_yaml, #related_posts, #relative_path, #render, #template, #title, #titleized_slug, #url, #url_placeholders
Methods included from Convertible
#converter, #do_layout, #merged_file_read_opts, #output_ext, #read_yaml, #render_all_layouts, #render_liquid, #to_liquid, #to_s, #transform, #write
Constructor Details
This class inherits a constructor from Jekyll::Post
Class Method Details
.valid?(name) ⇒ Boolean
Draft name validator. Draft filenames must be like: my-awesome-post.textile
Returns true if valid, false if not.
12 13 14 |
# File 'lib/jekyll/draft.rb', line 12 def self.valid?(name) name =~ MATCHER end |
Instance Method Details
#containing_dir(source, dir) ⇒ Object
Get the full path to the directory containing the draft files
17 18 19 |
# File 'lib/jekyll/draft.rb', line 17 def containing_dir(source, dir) File.join(source, dir, '_drafts') end |
#process(name) ⇒ Object
Extract information from the post filename.
name - The String filename of the post file.
Returns nothing.
26 27 28 29 30 31 |
# File 'lib/jekyll/draft.rb', line 26 def process(name) m, slug, ext = *name.match(MATCHER) self.date = File.mtime(File.join(@base, name)) self.slug = slug self.ext = ext end |