def post(opts)
      opts = @helper.ensure_open_struct(opts)
      date = @helper.get_date_stamp

      # still want to escape any garbage in the slug
      slug = if opts.slug.nil? || opts.slug.empty?
               opts.title
             else
               opts.slug
             end
      slug = @helper.get_slug_for(slug)

      # put the metadata into the layout header
      head, ext = @helper.get_layout(opts.layout)
      head.sub!(/^title:\s*$/, "title: #{opts.title}")
      head.sub!(/^date:\s*$/, "date: #{date}")
      ext ||= @ext

      path = File.join(POSTS_FOLDER, "#{date}-#{slug}.#{ext}")
      f = File.open(path, "w")
      f.write(head)
      f.close
      @helper.open_in_editor(path) # open file if config key set
      path    # return the path, in case we want to do anything useful
    end
def post(opts)
      opts = @helper.ensure_open_struct(opts)
      date = @helper.get_date_stamp

      
      slug = if opts.slug.nil? || opts.slug.empty?
               opts.title
             else
               opts.slug
             end
      slug = @helper.get_slug_for(slug)

      
      head, ext = @helper.get_layout(opts.layout)
      head.sub!(/^title:\s*$/, "title: 
      head.sub!(/^date:\s*$/, "date: 
      ext ||= @ext

      path = File.join(POSTS_FOLDER, "
      f = File.open(path, "w")
      f.write(head)
      f.close
      @helper.open_in_editor(path) 
      path    
    end
def post ( opts ) opts = @helper . ensure_open_struct ( opts ) date = @helper . get_date_stamp # still want to escape any garbage in the slug slug = if opts . slug . nil? || opts . slug . empty? opts . title else opts . slug end slug = @helper . get_slug_for ( slug ) # put the metadata into the layout header head , ext = @helper . get_layout ( opts . layout ) head . sub! ( / \s / , "title: #{opts.title}" ) head . sub! ( / \s / , "date: #{date}" ) ext ||= @ext path = File . join ( POSTS_FOLDER , "#{date}-#{slug}.#{ext}" ) f = File . open ( path , "w" ) f . write ( head ) f . close @helper . open_in_editor ( path ) # open file if config key set path # return the path, in case we want to do anything useful end
Generate a timestamped post
Generate a timestamped post