url: move setter outside of if statement

Addresses @envygeeks's comment:
d070a77716 (commitcomment-15164169)
This commit is contained in:
Parker Moore 2015-12-26 12:32:21 -05:00
parent b70ea3ca5c
commit 1f298e0d9d
1 changed files with 4 additions and 3 deletions

View File

@ -80,10 +80,11 @@ module Jekyll
def generate_url_from_drop(template)
template.gsub(/:([a-z_]+)/) do |match|
if replacement = @placeholders.public_send(match.sub(':', ''))
self.class.escape_path replacement
else
replacement = @placeholders.public_send(match.sub(':', ''))
if replacement.nil?
''.freeze
else
self.class.escape_path(replacement)
end
end.gsub(/\/\//, '/')
end