Move layout validity logic to separate method
This commit is contained in:
parent
072ddb799f
commit
a0d679439f
|
@ -153,6 +153,15 @@ module Jekyll
|
|||
!asset_file?
|
||||
end
|
||||
|
||||
# Checks if the layout specified in the document actually exists
|
||||
#
|
||||
# layout - the layout to check
|
||||
#
|
||||
# Returns true if the layout is invalid, false if otherwise
|
||||
def invalid_layout?(layout)
|
||||
!data["layout"].nil? && data["layout"] != "none" && layout.nil?
|
||||
end
|
||||
|
||||
# Recursively render layouts
|
||||
#
|
||||
# layouts - a list of the layouts
|
||||
|
@ -164,9 +173,7 @@ module Jekyll
|
|||
# recursively render layouts
|
||||
layout = layouts[data["layout"]]
|
||||
|
||||
if !data["layout"].nil? && data["layout"] != "none" && layout.nil?
|
||||
Jekyll.logger.warn("Build Warning:", "Layout #{data["layout"]} does not exist.")
|
||||
end
|
||||
Jekyll.logger.warn("Build Warning:", "Layout #{data["layout"]} does not exist.") if invalid_layout? layout
|
||||
|
||||
used = Set.new([layout])
|
||||
|
||||
|
|
|
@ -92,6 +92,15 @@ module Jekyll
|
|||
raise e
|
||||
end
|
||||
|
||||
# Checks if the layout specified in the document actually exists
|
||||
#
|
||||
# layout - the layout to check
|
||||
#
|
||||
# Returns true if the layout is invalid, false if otherwise
|
||||
def invalid_layout?(layout)
|
||||
!document.data["layout"].nil? && document.data["layout"] != "none" && layout.nil?
|
||||
end
|
||||
|
||||
# Render layouts and place given content inside.
|
||||
#
|
||||
# content - the content to be placed in the layout
|
||||
|
@ -102,9 +111,7 @@ module Jekyll
|
|||
output = content.dup
|
||||
layout = site.layouts[document.data["layout"]]
|
||||
|
||||
if !data["layout"].nil? && data["layout"] != "none" && layout.nil?
|
||||
Jekyll.logger.warn("Build Warning:", "Layout #{data["layout"]} does not exist.")
|
||||
end
|
||||
Jekyll.logger.warn("Build Warning:", "Layout #{document.data["layout"]} does not exist.") if invalid_layout? layout
|
||||
|
||||
used = Set.new([layout])
|
||||
|
||||
|
|
Loading…
Reference in New Issue