lib/octopress/page.rb in octopress-3.0.0.rc.35 vs lib/octopress/page.rb in octopress-3.0.0.rc.36

- old
+ new

@@ -15,38 +15,38 @@ @site = site @config = DEFAULT_OPTIONS.merge(site.config) @options = options set_default_options - @front_matter = %w{layout title date} + @front_matter = %w{title date} # Ensure title # @options['title'] ||= '' # Ensure a quoted title to avoid YAML parsing issues. # - @options['title'] = "\"#{@options['title']}\"" + @options['title'] = "#{@options['title']}" @content = options['content'] || content end def site @site end def write if File.exist?(path) && !@options['force'] - raise "File #{relative_path(path)} already exists. Use --force to overwrite." + abort "File #{relative_path(path)} already exists. Use --force to overwrite." end dir = File.dirname(path) FileUtils.mkdir_p(dir) File.open(path, 'w') { |f| f.write(@content) } if STDOUT.tty? - puts "New #{@options['type']}: #{relative_path(path)}" + puts "#{@options['write_message']} #{relative_path(path)}" # If path begins with an underscore the page is probably being added to a collection # if @options['type'] == 'page' print_collection_tip($1) if dir =~ /#{site.source}\/_([^\/]+)/ @@ -95,9 +95,10 @@ @options['extension'].sub(/^\./, '') end def set_default_options @options['type'] ||= 'page' + @options['write_message'] ||= 'New page:' @options['layout'] = @config['page_layout'] if @options['date'] @options['date'] = convert_date @options['date'] end @options['extension'] ||= @config['page_ext']