lib/octopress/page.rb in octopress-3.0.0.rc.1 vs lib/octopress/page.rb in octopress-3.0.0.rc.2

- old
+ new

@@ -60,26 +60,25 @@ @options['extension'].sub(/^\./, '') end def set_default_options @options['type'] ||= 'page' - @options['layout'] = @config['page_layout'] + @options['layout'] = @config['page_layout'] @options['date'] = convert_date @options['date'] @options['extension'] ||= @config['page_ext'] @options['template'] ||= @config['page_template'] end def convert_date(date) - if date - if @options['date'] == 'now' - @options['date'] = Time.now.iso8601 - else - begin - Time.parse(date.to_s).iso8601 - rescue => error - puts 'Could not parse date. Try formatting it like YYYY-MM-DD HH:MM' - abort error.message - end + date ||= 'now' + if date == 'now' + @options['date'] = Time.now.iso8601 + else + begin + Time.parse(date.to_s).iso8601 + rescue => error + puts 'Could not parse date. Try formatting it like YYYY-MM-DD HH:MM' + abort error.message end end end # Load the user provide or default template for a new post or page.