Memoize destination of pages, documents and staticfiles (#8458)
Merge pull request 8458
This commit is contained in:
parent
56d59a1782
commit
920c6f4ddc
|
@ -257,13 +257,16 @@ module Jekyll
|
|||
#
|
||||
# Returns the full path to the output file of this document.
|
||||
def destination(base_directory)
|
||||
path = site.in_dest_dir(base_directory, URL.unescape_path(url))
|
||||
if url.end_with? "/"
|
||||
path = File.join(path, "index.html")
|
||||
else
|
||||
path << output_ext unless path.end_with? output_ext
|
||||
@destination ||= {}
|
||||
@destination[base_directory] ||= begin
|
||||
path = site.in_dest_dir(base_directory, URL.unescape_path(url))
|
||||
if url.end_with? "/"
|
||||
path = File.join(path, "index.html")
|
||||
else
|
||||
path << output_ext unless path.end_with? output_ext
|
||||
end
|
||||
path
|
||||
end
|
||||
path
|
||||
end
|
||||
|
||||
# Write the generated Document file to the destination directory.
|
||||
|
|
|
@ -158,10 +158,13 @@ module Jekyll
|
|||
#
|
||||
# Returns the destination file path String.
|
||||
def destination(dest)
|
||||
path = site.in_dest_dir(dest, URL.unescape_path(url))
|
||||
path = File.join(path, "index") if url.end_with?("/")
|
||||
path << output_ext unless path.end_with? output_ext
|
||||
path
|
||||
@destination ||= {}
|
||||
@destination[dest] ||= begin
|
||||
path = site.in_dest_dir(dest, URL.unescape_path(url))
|
||||
path = File.join(path, "index") if url.end_with?("/")
|
||||
path << output_ext unless path.end_with? output_ext
|
||||
path
|
||||
end
|
||||
end
|
||||
|
||||
# Returns the object as a debug String.
|
||||
|
|
|
@ -55,7 +55,8 @@ module Jekyll
|
|||
#
|
||||
# Returns destination file path.
|
||||
def destination(dest)
|
||||
@site.in_dest_dir(dest, Jekyll::URL.unescape_path(url))
|
||||
@destination ||= {}
|
||||
@destination[dest] ||= @site.in_dest_dir(dest, Jekyll::URL.unescape_path(url))
|
||||
end
|
||||
|
||||
def destination_rel_dir
|
||||
|
|
Loading…
Reference in New Issue