diff options
author | Evan Read <eread@gitlab.com> | 2022-06-01 02:49:13 +0300 |
---|---|---|
committer | Evan Read <eread@gitlab.com> | 2022-06-01 02:49:13 +0300 |
commit | afd490e0cb73173125d483a8144c9dcc34d1b33d (patch) | |
tree | a58223ce28d9d3b4c487ff01826fd3e1f01f2390 | |
parent | 7587182c0ac4d601fb4dee0c9cf4dd9c4ab5b089 (diff) |
Remove unused helpereread/remove-unused-helper
-rw-r--r-- | lib/helpers/child_parent_better.rb | 49 | ||||
-rw-r--r-- | lib/helpers_.rb | 1 |
2 files changed, 0 insertions, 50 deletions
diff --git a/lib/helpers/child_parent_better.rb b/lib/helpers/child_parent_better.rb deleted file mode 100644 index c8427e40..00000000 --- a/lib/helpers/child_parent_better.rb +++ /dev/null @@ -1,49 +0,0 @@ -# frozen_string_literal: true - -module Nanoc::Helpers - module ChildParentBetter - # Returns an array of ancestor pages for the given page. - def ancestor_path_array(item) - puts item if @config[:debug] - - parent_array = [] - current_item = item - # Until the current item has no parent, keep running. - until (get_nearest_parent(current_item.identifier.to_s).nil?) do - # Set the current item to the last item in the array - # unless this is the first item. - current_item = parent_array.last unless parent_array.empty? - # Get the nearest parent of the current item. - parent = get_nearest_parent(current_item.identifier.to_s) - # Push the parent of the current item into the array. - parent_array.push(parent) if parent - end - - parent_array - end - - # A recursive function which returns the nearest parent item for the - # given path. - def get_nearest_parent(item_identifier) - puts item_identifier if @config[:debug] - - if (item_identifier.nil? || (item_identifier.to_s.end_with?('README.md', 'index.md') && item_identifier.to_s.split('/').length == 3)) - return - elsif item_identifier.to_s.end_with?('README.md', 'index.md') - parent_dir = item_identifier.sub(/[^\/]+$/, '').chop - return get_nearest_parent(parent_dir) - else - parent_dir = item_identifier.sub(/[^\/]+$/, '').chop - parent = @items["#{parent_dir}/README.*"] - alt_parent = @items["#{parent_dir}/index.*"] - if (parent.nil? && alt_parent.nil?) - get_nearest_parent(parent_dir) - elsif alt_parent.nil? - return parent - else - return alt_parent - end - end - end - end -end diff --git a/lib/helpers_.rb b/lib/helpers_.rb index 9d0c42ea..202d0576 100644 --- a/lib/helpers_.rb +++ b/lib/helpers_.rb @@ -3,7 +3,6 @@ include Nanoc::Helpers::LinkTo include Nanoc::Helpers::XMLSitemap include Nanoc::Helpers::Rendering -include Nanoc::Helpers::ChildParentBetter include Nanoc::Helpers::EditOnGitLab include Nanoc::Helpers::VersionsDropdown include Nanoc::Helpers::IconsHelper |