Added and improved documentation, fixed long method name.

Signed-off-by: Martin Jorn Rogalla <martin@martinrogalla.com>
This commit is contained in:
Martin Jorn Rogalla 2015-03-04 21:37:25 +01:00
parent 1b796354fb
commit 7114380da7
1 changed files with 29 additions and 2 deletions

View File

@ -145,7 +145,7 @@ module Jekyll
# #
# Returns nothing. # Returns nothing.
def render def render
relative_permalinks_deprecation_method deprecated_rel_permalink
payload = site_payload payload = site_payload
collections.each do |label, collection| collections.each do |label, collection|
@ -280,7 +280,11 @@ module Jekyll
end end
end end
def relative_permalinks_deprecation_method # Warns the user if permanent links are relative tot the parent
# directory. As this is a deprecated function of Jekyll.
#
# Returns
def deprecated_rel_permalink
if config['relative_permalinks'] && has_relative_page? if config['relative_permalinks'] && has_relative_page?
Jekyll::Deprecator.deprecation_message "Since v2.0, permalinks for pages" + Jekyll::Deprecator.deprecation_message "Since v2.0, permalinks for pages" +
" in subfolders must be relative to the" + " in subfolders must be relative to the" +
@ -290,16 +294,23 @@ module Jekyll
end end
end end
# Get the to be written documents
#
# Returns an Array of Documents which should be written
def docs_to_write def docs_to_write
documents.select(&:write?) documents.select(&:write?)
end end
# Get all the documents
#
# Returns an Array of all Documents
def documents def documents
collections.reduce(Set.new) do |docs, (_, collection)| collections.reduce(Set.new) do |docs, (_, collection)|
docs + collection.docs + collection.files docs + collection.docs + collection.files
end.to_a end.to_a
end end
def each_site_file def each_site_file
%w(posts pages static_files docs_to_write).each do |type| %w(posts pages static_files docs_to_write).each do |type|
send(type).each do |item| send(type).each do |item|
@ -308,6 +319,10 @@ module Jekyll
end end
end end
# Returns the FrontmatterDefaults or creates a new FrontmatterDefaults
# if it doesn't already exist.
#
# Returns The FrontmatterDefaults
def frontmatter_defaults def frontmatter_defaults
@frontmatter_defaults ||= FrontmatterDefaults.new(self) @frontmatter_defaults ||= FrontmatterDefaults.new(self)
end end
@ -319,16 +334,28 @@ module Jekyll
override['full_rebuild'] || config['full_rebuild'] override['full_rebuild'] || config['full_rebuild']
end end
# Returns the publisher or creates a new publisher if it doesn't
# already exist.
#
# Returns The Publisher
def publisher def publisher
@publisher ||= Publisher.new(self) @publisher ||= Publisher.new(self)
end end
private private
# Checks if the site has any pages containing relative links
#
# Returns a Boolean: true for usage of relateive permalinks, false
# if it doesn't
def has_relative_page? def has_relative_page?
pages.any? { |page| page.uses_relative_permalinks } pages.any? { |page| page.uses_relative_permalinks }
end end
# Returns the Cleaner or creates a new Cleaner if it doesn't
# already exist.
#
# Returns The Cleaner
def site_cleaner def site_cleaner
@site_cleaner ||= Cleaner.new(self) @site_cleaner ||= Cleaner.new(self)
end end