diff options
author | Achilleas Pipinellis <axilleas@axilleas.me> | 2017-09-10 20:05:57 +0300 |
---|---|---|
committer | Achilleas Pipinellis <axilleas@axilleas.me> | 2017-09-10 20:05:57 +0300 |
commit | 259982ccd3f72eb19e938fa929301a7725b3d1da (patch) | |
tree | 95a84a20d52308c666e3e68f30af0f7f827e637f | |
parent | ea5f2ee6d944c4fe5443dbb589600c4906969ce6 (diff) |
Let us define a "title: This is a title" in a document
Without this change, the regex was being confused if
there were other strings starting with '#' (like code comments)
-rw-r--r-- | Rules | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -11,9 +11,11 @@ preprocess do item[:redirect] = item[:redirect].gsub!(/\.md/, '.html') end - title = item.raw_content.match(/^[#] .*$/).to_s - title.gsub!('# ', '') - item[:title] = title unless title.empty? + unless item[:title] + title = item.raw_content.match(/^[#] .*$/).to_s + title.gsub!('# ', '') + item[:title] = title unless title.empty? + end end end end |