From 7114380da7846dd99f3c456d5b1c7f6dea3faa78 Mon Sep 17 00:00:00 2001 From: Martin Jorn Rogalla Date: Wed, 4 Mar 2015 21:37:25 +0100 Subject: [PATCH] Added and improved documentation, fixed long method name. Signed-off-by: Martin Jorn Rogalla --- lib/jekyll/site.rb | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index ff530834..fd1b2661 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -145,7 +145,7 @@ module Jekyll # # Returns nothing. def render - relative_permalinks_deprecation_method + deprecated_rel_permalink payload = site_payload collections.each do |label, collection| @@ -280,7 +280,11 @@ module Jekyll 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? Jekyll::Deprecator.deprecation_message "Since v2.0, permalinks for pages" + " in subfolders must be relative to the" + @@ -290,16 +294,23 @@ module Jekyll end end + # Get the to be written documents + # + # Returns an Array of Documents which should be written def docs_to_write documents.select(&:write?) end + # Get all the documents + # + # Returns an Array of all Documents def documents collections.reduce(Set.new) do |docs, (_, collection)| docs + collection.docs + collection.files end.to_a end + def each_site_file %w(posts pages static_files docs_to_write).each do |type| send(type).each do |item| @@ -308,6 +319,10 @@ module Jekyll end end + # Returns the FrontmatterDefaults or creates a new FrontmatterDefaults + # if it doesn't already exist. + # + # Returns The FrontmatterDefaults def frontmatter_defaults @frontmatter_defaults ||= FrontmatterDefaults.new(self) end @@ -319,16 +334,28 @@ module Jekyll override['full_rebuild'] || config['full_rebuild'] end + # Returns the publisher or creates a new publisher if it doesn't + # already exist. + # + # Returns The Publisher def publisher @publisher ||= Publisher.new(self) end 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? pages.any? { |page| page.uses_relative_permalinks } end + # Returns the Cleaner or creates a new Cleaner if it doesn't + # already exist. + # + # Returns The Cleaner def site_cleaner @site_cleaner ||= Cleaner.new(self) end