|
|
@ -7,17 +7,72 @@ module Docs
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def get_type
|
|
|
|
def get_type
|
|
|
|
components = slug.split('/')
|
|
|
|
if slug.start_with?('classreference')
|
|
|
|
type = components.first
|
|
|
|
type = slug.split('/').drop(1).first
|
|
|
|
type
|
|
|
|
|
|
|
|
|
|
|
|
if type.nil?
|
|
|
|
|
|
|
|
'Class Reference'
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
type
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
elsif slug.start_with?('docs')
|
|
|
|
|
|
|
|
type = slug.split('/').drop(1).first
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
coreconcepts_patterns = [/users/, /sections/, /entries/, /globals/, /assets/, /categories/, /tags/, /fields/, /relations/, /routing/, /searching/, /image-transforms/]
|
|
|
|
|
|
|
|
coreconcepts_regex = Regexp.union(coreconcepts_patterns)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if type.nil?
|
|
|
|
|
|
|
|
'Docs'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
elsif type.include?('folder')
|
|
|
|
|
|
|
|
'Docs'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
elsif type.include?('plugins')
|
|
|
|
|
|
|
|
'Docs\\Plugins'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
elsif type.include?('config') || type.in?(%w(php-constants))
|
|
|
|
|
|
|
|
'Docs\\Configuration'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
elsif type.in?(%w(requirements updating installing))
|
|
|
|
|
|
|
|
'Docs\\Installing and Updating'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
elsif type.match(coreconcepts_regex)
|
|
|
|
|
|
|
|
out = 'Docs\\Core Concepts'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if type.include?('fields')
|
|
|
|
|
|
|
|
out << "\\Fields"
|
|
|
|
|
|
|
|
elsif type.include?('transforms') || type.include?('assets')
|
|
|
|
|
|
|
|
out << "\\Assets"
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
out
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
elsif type.include?('templating') || type.include?('twig')
|
|
|
|
|
|
|
|
'Docs\\Templating'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
elsif type.include?('localization')
|
|
|
|
|
|
|
|
'Docs\\Guides'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
type
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def additional_entries
|
|
|
|
def additional_entries
|
|
|
|
classname = at_css('h1').content.strip
|
|
|
|
# Get Class Name from get_name method
|
|
|
|
|
|
|
|
classname = get_name
|
|
|
|
|
|
|
|
|
|
|
|
css('header.h3 h3').each_with_object [] do |node, entries|
|
|
|
|
css('header.h3 h3').each_with_object [] do |node, entries|
|
|
|
|
|
|
|
|
# Get Property Name, Method Name, etc
|
|
|
|
name = node.at_css('code').content.strip
|
|
|
|
name = node.at_css('code').content.strip
|
|
|
|
label = classname + " " + name
|
|
|
|
label = classname + " " + name
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Set Property|Method id of <a> that is the same in clean_html_v2.rb
|
|
|
|
tag = name.tr('()', '') + '-detail'
|
|
|
|
tag = name.tr('()', '') + '-detail'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Append to entries array
|
|
|
|
entries << [label, tag]
|
|
|
|
entries << [label, tag]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|