|
|
@ -3,10 +3,13 @@ module Docs
|
|
|
|
class EntriesFilter < Docs::EntriesFilter
|
|
|
|
class EntriesFilter < Docs::EntriesFilter
|
|
|
|
def get_name
|
|
|
|
def get_name
|
|
|
|
if base_url.path.start_with?('/api')
|
|
|
|
if base_url.path.start_with?('/api')
|
|
|
|
name = at_css('.api-header').content.split.first
|
|
|
|
name = at_css('h1').child.content.strip
|
|
|
|
# Remove "Ember." prefix if the next character is uppercase
|
|
|
|
# Remove "Ember." prefix if the next character is uppercase
|
|
|
|
name.sub! %r{\AEmber\.([A-Z])(?!EATURES)}, '\1'
|
|
|
|
name.sub! %r{\AEmber\.([A-Z])(?!EATURES)}, '\1'
|
|
|
|
name == 'Handlebars.helpers' ? 'Handlebars Helpers' : name
|
|
|
|
name << ' (methods)' if subpath.end_with?('/methods')
|
|
|
|
|
|
|
|
name << ' (properties)' if subpath.end_with?('/properties')
|
|
|
|
|
|
|
|
name << ' (events)' if subpath.end_with?('/events')
|
|
|
|
|
|
|
|
name
|
|
|
|
else
|
|
|
|
else
|
|
|
|
name = at_css('article h1').content.remove('Edit Page').strip
|
|
|
|
name = at_css('article h1').content.remove('Edit Page').strip
|
|
|
|
name = at_css('li.toc-level-0.selected > a').content if name == 'Introduction'
|
|
|
|
name = at_css('li.toc-level-0.selected > a').content if name == 'Introduction'
|
|
|
@ -16,13 +19,14 @@ module Docs
|
|
|
|
|
|
|
|
|
|
|
|
def get_type
|
|
|
|
def get_type
|
|
|
|
if base_url.path.start_with?('/api')
|
|
|
|
if base_url.path.start_with?('/api')
|
|
|
|
if at_css('.api-header').content.include?('Module')
|
|
|
|
name = self.name.remove(/ \(.*/)
|
|
|
|
|
|
|
|
if name =~ /\A[a-z\-]+\z/
|
|
|
|
'Modules'
|
|
|
|
'Modules'
|
|
|
|
elsif name.start_with? 'DS'
|
|
|
|
elsif name.start_with?('DS')
|
|
|
|
'Data'
|
|
|
|
'Data'
|
|
|
|
elsif name.start_with? 'RSVP'
|
|
|
|
elsif name.start_with?('RSVP')
|
|
|
|
'RSVP'
|
|
|
|
'RSVP'
|
|
|
|
elsif name.start_with? 'Test'
|
|
|
|
elsif name.start_with?('Test')
|
|
|
|
'Test'
|
|
|
|
'Test'
|
|
|
|
elsif name.start_with?('Ember')
|
|
|
|
elsif name.start_with?('Ember')
|
|
|
|
name.split('.')[0..1].join('.')
|
|
|
|
name.split('.')[0..1].join('.')
|
|
|
@ -41,29 +45,21 @@ module Docs
|
|
|
|
def additional_entries
|
|
|
|
def additional_entries
|
|
|
|
return [] unless base_url.path.start_with?('/api')
|
|
|
|
return [] unless base_url.path.start_with?('/api')
|
|
|
|
|
|
|
|
|
|
|
|
css('.item-entry:not(.inherited)').map do |node|
|
|
|
|
css('section').each_with_object [] do |node, entries|
|
|
|
|
heading = node.at_css('h3[data-id]')
|
|
|
|
next unless heading = node.at_css('h3[data-anchor]')
|
|
|
|
name = heading.content.strip
|
|
|
|
next if node.at_css('.github-link').content.include?('Inherited')
|
|
|
|
|
|
|
|
name = heading.at_css('span').content.strip
|
|
|
|
if self.name == 'Handlebars Helpers'
|
|
|
|
|
|
|
|
name << ' (handlebars helper)'
|
|
|
|
|
|
|
|
next [name, heading['data-id']]
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Give their own type to "Ember.platform", "Ember.run", etc.
|
|
|
|
# Give their own type to "Ember.platform", "Ember.run", etc.
|
|
|
|
if self.type != 'Data' && name.include?('.')
|
|
|
|
if self.type != 'Data' && name.include?('.')
|
|
|
|
type = "#{self.name}.#{name.split('.').first}"
|
|
|
|
type = "#{self.name.remove(/ \(.*/)}.#{name.split('.').first}"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
# "." = class method, "#" = instance method
|
|
|
|
name.prepend "#{self.name.remove(/ \(.*/)}."
|
|
|
|
separator = '#'
|
|
|
|
name << '()' if node['class'].include?('method')
|
|
|
|
separator = '.' if self.name == 'Ember' || self.name.split('.').last =~ /\A[a-z]/ || node.at_css('.static')
|
|
|
|
name << ' (event)' if node['class'].include?('event')
|
|
|
|
name.prepend self.name + separator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
name << '()' if node['class'].include? 'method'
|
|
|
|
|
|
|
|
name << ' event' if node['class'].include? 'event'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[name, heading['data-id'], type]
|
|
|
|
entries << [name, heading['data-anchor'], type]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|