File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -40,12 +40,13 @@ module JB
4040 end #Path
4141end #JB
4242
43- # Usage: rake post title="A Title" [date="2012-02-09"] [tags=[tag1, tag2]]
43+ # Usage: rake post title="A Title" [date="2012-02-09"] [tags=[tag1,tag2]] [category="category" ]
4444desc "Begin a new post in #{ CONFIG [ 'posts' ] } "
4545task :post do
4646 abort ( "rake aborted: '#{ CONFIG [ 'posts' ] } ' directory not found." ) unless FileTest . directory? ( CONFIG [ 'posts' ] )
4747 title = ENV [ "title" ] || "new-post"
4848 tags = ENV [ "tags" ] || "[]"
49+ category = ENV [ "category" ] || ""
4950 slug = title . downcase . strip . gsub ( ' ' , '-' ) . gsub ( /[^\w -]/ , '' )
5051 begin
5152 date = ( ENV [ 'date' ] ? Time . parse ( ENV [ 'date' ] ) : Time . now ) . strftime ( '%Y-%m-%d' )
@@ -64,7 +65,7 @@ task :post do
6465 post . puts "layout: post"
6566 post . puts "title: \" #{ title . gsub ( /-/ , ' ' ) } \" "
6667 post . puts 'description: ""'
67- post . puts "category: "
68+ post . puts "category: \" #{ category . gsub ( /-/ , ' ' ) } \" "
6869 post . puts "tags: #{ tags } "
6970 post . puts "---"
7071 post . puts "{% include JB/setup %}"
You can’t perform that action at this time.
0 commit comments