diff options
author | David O'Regan <doregan@gitlab.com> | 2022-06-01 12:17:09 +0300 |
---|---|---|
committer | David O'Regan <doregan@gitlab.com> | 2022-06-01 12:17:09 +0300 |
commit | 490cc6f1d5f3cff9fe72e40aab70f7ea6a2c8a1b (patch) | |
tree | 53f2bce5e48d931e7bc029a07e80ea7f1ac5774f | |
parent | 66be31eeece905b6f97edb26deadca85e95c70d7 (diff) | |
parent | afd490e0cb73173125d483a8144c9dcc34d1b33d (diff) |
Merge branch 'eread/remove-unused-helper' into 'main'
Remove unused helper
See merge request gitlab-org/gitlab-docs!2750
-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 |