From a1835c0a310830a16ea4c61cad9f0f193347e4e6 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Tue, 8 Mar 2016 16:46:17 -0600 Subject: [PATCH] Fix rakefile when you don't have a title in markdown --- Rakefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Rakefile b/Rakefile index d4365723..8bbb7728 100644 --- a/Rakefile +++ b/Rakefile @@ -89,7 +89,11 @@ end def siteify_file(file, front_matter = {}) abort "You seem to have misplaced your #{file} file. I can haz?" unless File.exists?(file) - title = File.read(file).match(/\A# (.*)$/)[1] + title = begin + File.read(file).match(/\A# (.*)$/)[1] + rescue + File.basename(file, ".*") + end slug = File.basename(file, ".markdown").downcase front_matter = front_matter.merge({ "title" => title, @@ -107,7 +111,7 @@ def content_for(file) when "History.markdown" converted_history(contents) else - contents.gsub!(/\A# .*\n\n?/, "") + contents.gsub(/\A# .*\n\n?/, "") end end