lib/docubot/link_tree.rb
# Add a new link underneath a link to its logical parent
Add a new link underneath a link to its logical parent
Add a new link underneath a link to its logical parent
def add_to_link_hierarchy( title, link, page=nil )
		node = DocuBot::LinkTree::Node.new( title, link, page )
		parent_link = if node.anchor
			node.file
		elsif File.basename(link)=='index.html'
			File.dirname(File.dirname(link))/'index.html'
		else
			(File.dirname(link) / 'index.html')
		end
		parent = descendants.find{ |n| n.link==parent_link } || self
		parent << node
	end
def add_to_link_hierarchy ( title , link , page = nil ) node = DocuBot :: LinkTree :: Node . new ( title , link , page ) parent_link = if node . anchor node . file elsif File . basename ( link ) == 'index.html' File . dirname ( File . dirname ( link ) ) / 'index.html' else ( File . dirname ( link ) / 'index.html' ) end parent = descendants . find { | n | n . link == parent_link } || self parent << node end
Add a new link underneath a link to its logical parent
Add a new link underneath a link to its logical parent
#puts "Adding #{title.inspect} (#{link}) to hierarchy under #{parent_link}"
title
link
page