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