Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorConnor Shea <connor.james.shea@gmail.com>2016-10-27 07:51:09 +0300
committerConnor Shea <connor.james.shea@gmail.com>2016-10-27 07:51:09 +0300
commit280cdc29c34beece0dadb41a462baf2b74c29789 (patch)
tree0d5695b0dd56b6ea314f3319d8a7797b4d7532d4 /lib
parentbf1c63a1b46e1cacb0c27e4946da40917bf82926 (diff)
Working breadcrumbs!
Diffstat (limited to 'lib')
-rw-r--r--lib/helpers/child_parent_better.rb18
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/helpers/child_parent_better.rb b/lib/helpers/child_parent_better.rb
index 8f8945cd..0a4ed86e 100644
--- a/lib/helpers/child_parent_better.rb
+++ b/lib/helpers/child_parent_better.rb
@@ -1,5 +1,21 @@
module Nanoc::Helpers
module ChildParentBetter
+ def parent_path_array(item)
+ parent_array = Array.new
+ current_item = item
+ until (parent_path(current_item).nil?) do
+ if (parent_array.length == 0)
+ parent = parent_path(item)
+ parent_array.push(parent) if parent
+ else
+ parent = parent_path(parent_array.last)
+ current_item = parent_array.last
+ parent_array.push(parent) if parent
+ end
+ end
+ parent_array
+ end
+
def parent_path(item)
parent = get_nearest_parent(item.identifier.to_s)
parent
@@ -11,7 +27,7 @@ module Nanoc::Helpers
return
elsif item_identifier.to_s.end_with?('README.md')
parent_dir = item_identifier.sub(/[^\/]+$/, '').chop
- get_nearest_parent(parent_dir)
+ return get_nearest_parent(parent_dir)
else
parent_dir = item_identifier.sub(/[^\/]+$/, '').chop
parent = @items[parent_dir + '/README.*']