...
|
...
|
@@ -82,9 +82,9 @@ task :new_page, :filename do |t, args|
|
82
|
82
|
args.with_defaults(:filename => 'new-page')
|
83
|
83
|
page_dir = source_dir
|
84
|
84
|
if args.filename =~ /(^.+\/)?(\w+)(\.)?(.+)?/
|
85
|
|
- page_dir += "/#{$1}"
|
86
|
|
- name = $2
|
87
|
|
- extension = $4 || new_page_ext
|
|
85
|
+ page_dir += $4 ? "/#{$1}" : "/#{$1}#{$2}/"
|
|
86
|
+ name = $4 ? $2 : "index"
|
|
87
|
+ extension = $4 || "#{new_page_ext}"
|
88
|
88
|
filename = "#{name}.#{extension}"
|
89
|
89
|
mkdir_p page_dir
|
90
|
90
|
file = page_dir + filename
|
...
|
...
|
@@ -92,7 +92,7 @@ task :new_page, :filename do |t, args|
|
92
|
92
|
open(file, 'w') do |page|
|
93
|
93
|
page.puts "---"
|
94
|
94
|
page.puts "layout: page"
|
95
|
|
- page.puts "title: \"#{name.gsub(/[-_]/, ' ').titlecase}\""
|
|
95
|
+ page.puts "title: \"#{$2.gsub(/[-_]/, ' ').titlecase}\""
|
96
|
96
|
page.puts "date: #{Time.now.strftime('%Y-%m-%d %H:%M')}"
|
97
|
97
|
page.puts "comments: true"
|
98
|
98
|
page.puts "sharing: true"
|