Removes 'titlecase' from page name, fixes #202
This commit is contained in:
parent
fe19c2aaae
commit
4b87a2fb7d
6
Rakefile
6
Rakefile
@ -91,7 +91,6 @@ end
|
|||||||
desc "Begin a new post in #{source_dir}/#{posts_dir}"
|
desc "Begin a new post in #{source_dir}/#{posts_dir}"
|
||||||
task :new_post, :title do |t, args|
|
task :new_post, :title do |t, args|
|
||||||
raise "### You haven't set anything up yet. First run `rake install` to set up an Octopress theme." unless File.directory?(source_dir)
|
raise "### You haven't set anything up yet. First run `rake install` to set up an Octopress theme." unless File.directory?(source_dir)
|
||||||
require './plugins/titlecase.rb'
|
|
||||||
mkdir_p "#{source_dir}/#{posts_dir}"
|
mkdir_p "#{source_dir}/#{posts_dir}"
|
||||||
args.with_defaults(:title => 'new-post')
|
args.with_defaults(:title => 'new-post')
|
||||||
title = args.title
|
title = args.title
|
||||||
@ -103,7 +102,7 @@ task :new_post, :title do |t, args|
|
|||||||
open(filename, 'w') do |post|
|
open(filename, 'w') do |post|
|
||||||
post.puts "---"
|
post.puts "---"
|
||||||
post.puts "layout: post"
|
post.puts "layout: post"
|
||||||
post.puts "title: \"#{title.gsub(/&/,'&').titlecase}\""
|
post.puts "title: \"#{title.gsub(/&/,'&')}\""
|
||||||
post.puts "date: #{Time.now.strftime('%Y-%m-%d %H:%M')}"
|
post.puts "date: #{Time.now.strftime('%Y-%m-%d %H:%M')}"
|
||||||
post.puts "comments: true"
|
post.puts "comments: true"
|
||||||
post.puts "categories: "
|
post.puts "categories: "
|
||||||
@ -115,7 +114,6 @@ end
|
|||||||
desc "Create a new page in #{source_dir}/(filename)/index.#{new_page_ext}"
|
desc "Create a new page in #{source_dir}/(filename)/index.#{new_page_ext}"
|
||||||
task :new_page, :filename do |t, args|
|
task :new_page, :filename do |t, args|
|
||||||
raise "### You haven't set anything up yet. First run `rake install` to set up an Octopress theme." unless File.directory?(source_dir)
|
raise "### You haven't set anything up yet. First run `rake install` to set up an Octopress theme." unless File.directory?(source_dir)
|
||||||
require './plugins/titlecase.rb'
|
|
||||||
args.with_defaults(:filename => 'new-page')
|
args.with_defaults(:filename => 'new-page')
|
||||||
page_dir = source_dir
|
page_dir = source_dir
|
||||||
if args.filename =~ /(^.+\/)?([\w_-]+)(\.)?(.+)?/
|
if args.filename =~ /(^.+\/)?([\w_-]+)(\.)?(.+)?/
|
||||||
@ -132,7 +130,7 @@ task :new_page, :filename do |t, args|
|
|||||||
open(file, 'w') do |page|
|
open(file, 'w') do |page|
|
||||||
page.puts "---"
|
page.puts "---"
|
||||||
page.puts "layout: page"
|
page.puts "layout: page"
|
||||||
page.puts "title: \"#{$2.gsub(/[-_]/, ' ').titlecase}\""
|
page.puts "title: \"#{$2.gsub(/[-_]/, ' ')}\""
|
||||||
page.puts "date: #{Time.now.strftime('%Y-%m-%d %H:%M')}"
|
page.puts "date: #{Time.now.strftime('%Y-%m-%d %H:%M')}"
|
||||||
page.puts "comments: true"
|
page.puts "comments: true"
|
||||||
page.puts "sharing: true"
|
page.puts "sharing: true"
|
||||||
|
Loading…
Reference in New Issue
Block a user