|
|
@ -26,15 +26,26 @@ module Docs
|
|
|
|
def additional_entries
|
|
|
|
def additional_entries
|
|
|
|
entries = []
|
|
|
|
entries = []
|
|
|
|
type = ""
|
|
|
|
type = ""
|
|
|
|
css("h1").each do |node|
|
|
|
|
if "#{self.base_url}" == "https://www.nushell.sh/book/" && !self.root_page?
|
|
|
|
name = node.at_css("code") ?
|
|
|
|
active_items = css("a.sidebar-item.active")
|
|
|
|
node.at_css("code").text : node.text
|
|
|
|
if active_items.length > 0
|
|
|
|
type = node.children.length >= 3 ?
|
|
|
|
type = active_items[0].text.strip()
|
|
|
|
node.children[2].text.sub(" for ", "").capitalize :
|
|
|
|
name = active_items[-1].text.strip()
|
|
|
|
node.text
|
|
|
|
id = "_"
|
|
|
|
# id = type.downcase.gsub(" ", "-")
|
|
|
|
entries << [name, id, type]
|
|
|
|
id = "_"
|
|
|
|
end
|
|
|
|
if name != "Command Reference"
|
|
|
|
else
|
|
|
|
|
|
|
|
css("h1").each do |node|
|
|
|
|
|
|
|
|
name = node.at_css("code") ?
|
|
|
|
|
|
|
|
node.at_css("code").text : node.text
|
|
|
|
|
|
|
|
type = node.children.length >= 3 ?
|
|
|
|
|
|
|
|
node.children[2].text.sub(" for ", "").capitalize :
|
|
|
|
|
|
|
|
node.text
|
|
|
|
|
|
|
|
# id = type.downcase.gsub(" ", "-")
|
|
|
|
|
|
|
|
id = "_"
|
|
|
|
|
|
|
|
if self.root_page?
|
|
|
|
|
|
|
|
id = "#{self.base_url}".split('/')[-1]
|
|
|
|
|
|
|
|
end
|
|
|
|
entries << [name, id, type]
|
|
|
|
entries << [name, id, type]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|