Have to go back on all these...
This commit is contained in:
parent
2eb318a929
commit
5cb0aee251
|
@ -49,7 +49,7 @@ module Jekyll
|
|||
#
|
||||
# Returns a Set with the directory paths
|
||||
def new_dirs
|
||||
new_files.flat_map { |file| parent_dirs(file) }.to_set
|
||||
new_files.map { |file| parent_dirs(file) }.flatten.to_set
|
||||
end
|
||||
|
||||
# Private: The list of parent directories of a given file
|
||||
|
@ -76,7 +76,7 @@ module Jekyll
|
|||
#
|
||||
# Returns a Set with the directory paths
|
||||
def keep_dirs
|
||||
site.keep_files.flat_map { |file| parent_dirs(File.join(site.dest, file)) }.to_set
|
||||
site.keep_files.map { |file| parent_dirs(File.join(site.dest, file)) }.flatten.to_set
|
||||
end
|
||||
|
||||
# Private: Creates a regular expression from the config's keep_files array
|
||||
|
|
|
@ -115,7 +115,7 @@ module Jekyll
|
|||
#
|
||||
# Returns the post title
|
||||
def title
|
||||
data.fetch("title") { titleized_slug }
|
||||
data.fetch('title') { titleized_slug }
|
||||
end
|
||||
|
||||
# Turns the post slug into a suitable title
|
||||
|
|
|
@ -46,24 +46,23 @@ module Jekyll
|
|||
# Returns the _unsanitizied_ String URL
|
||||
def generate_url
|
||||
@placeholders.inject(@template) do |result, token|
|
||||
result.tr(":#{token.first}", self.class.escape_path(token.last))
|
||||
break result if result.index(':').nil?
|
||||
result.gsub(':#{token.first}', self.class.escape_path(token.last))
|
||||
end
|
||||
end
|
||||
|
||||
# Returns a sanitized String URL
|
||||
def sanitize_url(in_url)
|
||||
url = in_url
|
||||
url = in_url \
|
||||
# Remove all double slashes
|
||||
.tr('//', '/') \
|
||||
|
||||
.gsub(/\/\//, '/') \
|
||||
# Remove every URL segment that consists solely of dots
|
||||
.split('/').reject{ |part| part =~ /^\.+$/ }.join('/') \
|
||||
|
||||
# Always add a leading slash
|
||||
.gsub(/\A([^\/])/, '/\1')
|
||||
|
||||
# Append a trailing slash to the URL if the unsanitized URL had one
|
||||
url << "/" if in_url =~ /\/$/
|
||||
url << "/" if in_url[-1].eql?('/')
|
||||
|
||||
url
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue