Fixup post action and template
authorJoerg Jaspert <joerg@debian.org>
Sun, 6 Mar 2016 21:55:03 +0000 (22:55 +0100)
committerJoerg Jaspert <joerg@debian.org>
Sun, 6 Mar 2016 21:55:03 +0000 (22:55 +0100)
Rakefile
_layouts/_post.txt

index 532687c..ab563e2 100644 (file)
--- a/Rakefile
+++ b/Rakefile
@@ -51,7 +51,7 @@ end
 # Save the file with the title in the YAML front matter
 def write_file(content, title, directory, filename)
   parsed_content = "#{content.sub("title:", "title: \"#{title}\"")}"
-  parsed_content = "#{parsed_content.sub("date:", "date: #{POST_TIME}")}"
+  parsed_content = "#{parsed_content.sub("date:", "date: '#{POST_TIME}'")}"
   File.write("#{directory}/#{filename}", parsed_content)
   puts "#{filename} was created in '#{directory}'."
 end
@@ -90,10 +90,10 @@ task :post, [:title] do |t, args|
   template = CONFIG["post"]["template"]
   extension = CONFIG["post"]["extension"]
   editor = CONFIG["editor"]
-  check_title(:title)
-  filename = "#{DATE}-#{transform_to_slug(:title, extension)}"
+  check_title(args.title)
+  filename = "#{DATE}-#{transform_to_slug(args.title, extension)}"
   content = read_file(template)
-  create_file(POSTS, filename, content, :title, editor)
+  create_file(POSTS, filename, content, args.title, editor)
 end
 
 # rake draft["Title"]
index c2a1143..7dc4ddb 100644 (file)
@@ -1,9 +1,9 @@
 ---
+layout: post
 title:
 subtitle:
 description:
 image:
-layout: post
 permalink:
 published: false
 categories: