|
|
@ -3,12 +3,14 @@ module Docs
|
|
|
|
class EntriesFilter < Docs::EntriesFilter
|
|
|
|
class EntriesFilter < Docs::EntriesFilter
|
|
|
|
def get_name
|
|
|
|
def get_name
|
|
|
|
if slug.start_with?('push/')
|
|
|
|
if slug.start_with?('push/')
|
|
|
|
name = at_css('#main-content h2').try(:content)
|
|
|
|
name = at_css('#inner h2').try(:content)
|
|
|
|
elsif slug.start_with?('cli/')
|
|
|
|
elsif slug.start_with?('cli/')
|
|
|
|
name = at_css('#main-content h1 + p > strong > code').try(:content).try(:[], /\s*vagrant\s+[\w\-]+/)
|
|
|
|
name = at_css('#inner h1 + p > strong > code').try(:content).try(:[], /\s*vagrant\s+[\w\-]+/)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
name || at_css('#main-content h1').content
|
|
|
|
name ||= at_css('#inner h1').content
|
|
|
|
|
|
|
|
name.remove! "» "
|
|
|
|
|
|
|
|
name
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def get_type
|
|
|
|
def get_type
|
|
|
@ -22,11 +24,11 @@ module Docs
|
|
|
|
case at_css('h1 + p > strong > code').try(:content)
|
|
|
|
case at_css('h1 + p > strong > code').try(:content)
|
|
|
|
when /config\./
|
|
|
|
when /config\./
|
|
|
|
h2 = nil
|
|
|
|
h2 = nil
|
|
|
|
css('#main-content .bs-docs-section > *').each_with_object [] do |node, entries|
|
|
|
|
css('#inner > *').each_with_object [] do |node, entries|
|
|
|
|
next if node.name == 'pre'
|
|
|
|
next if node.name == 'pre'
|
|
|
|
if node.name == 'h2'
|
|
|
|
if node.name == 'h2'
|
|
|
|
h2 = node.content
|
|
|
|
h2 = node['id']
|
|
|
|
elsif h2 == 'Available Settings' && (code = node.at_css('code')) && (name = code.content) && name.start_with?('config.')
|
|
|
|
elsif h2 == 'available-settings' && (code = node.at_css('code')) && (name = code.content) && name.start_with?('config.')
|
|
|
|
id = code.parent['id'] = name.parameterize
|
|
|
|
id = code.parent['id'] = name.parameterize
|
|
|
|
entries << [name, id, 'Config']
|
|
|
|
entries << [name, id, 'Config']
|
|
|
|
end
|
|
|
|
end
|
|
|
|