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

Version Path
jekyll-1.5.1 lib/jekyll/draft.rb
jekyll-1.5.0 lib/jekyll/draft.rb
jekyll-2.0.0.alpha.1 lib/jekyll/draft.rb
jekyll-1.4.3 lib/jekyll/draft.rb
jekyll-1.4.2 lib/jekyll/draft.rb
jekyll-1.4.1 lib/jekyll/draft.rb
jekyll-1.4.0 lib/jekyll/draft.rb
jekyll-1.3.1 lib/jekyll/draft.rb
jekyll-1.3.0 lib/jekyll/draft.rb
jekyll-1.3.0.rc lib/jekyll/draft.rb
monad-0.0.3 lib/jekyll/draft.rb
jekyll-1.2.1 lib/jekyll/draft.rb
jekyll-1.2.0 lib/jekyll/draft.rb
jekyll-1.0.4 lib/jekyll/draft.rb
jekyll-1.1.2 lib/jekyll/draft.rb
jekyll-1.1.1 lib/jekyll/draft.rb
jekyll-1.0.3 lib/jekyll/draft.rb
jekyll-1.0.2 lib/jekyll/draft.rb
jekyll-1.0.1 lib/jekyll/draft.rb
jekyll-1.0.0 lib/jekyll/draft.rb