|
|
|
@ -2,8 +2,15 @@ module Docs
|
|
|
|
|
class Dart
|
|
|
|
|
class EntriesFilter < Docs::EntriesFilter
|
|
|
|
|
def get_name
|
|
|
|
|
title = get_title
|
|
|
|
|
kind = get_kind
|
|
|
|
|
title = at_css('h1.title')
|
|
|
|
|
if title # v1
|
|
|
|
|
name = title.element_children.last.content.strip
|
|
|
|
|
kind = title.at_css('.kind').content
|
|
|
|
|
else # v2
|
|
|
|
|
title = at_css('.main-content > h1')
|
|
|
|
|
name = title.content[/(.*)( )/, 1].split(' top-level')[0]
|
|
|
|
|
kind = title.content[/(.*)( )(.+)/, 3]
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
breadcrumbs = at_css('.breadcrumbs').css('li:not(.self-crumb) > a')
|
|
|
|
|
first_part = ''
|
|
|
|
@ -15,6 +22,7 @@ module Docs
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
separator = ''
|
|
|
|
|
|
|
|
|
|
unless first_part.empty?
|
|
|
|
|
if kind.include?('class')
|
|
|
|
|
separator = ':'
|
|
|
|
@ -23,36 +31,12 @@ module Docs
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
first_part + separator + title
|
|
|
|
|
"#{first_part}#{separator}#{name}"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def get_type
|
|
|
|
|
at_css('.breadcrumbs > li:nth-child(2)').content.split(' ')[0]
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def get_title
|
|
|
|
|
title = at_css('h1.title')
|
|
|
|
|
|
|
|
|
|
if not title.nil?
|
|
|
|
|
# v1
|
|
|
|
|
title.children.last.content.strip
|
|
|
|
|
else
|
|
|
|
|
# v2
|
|
|
|
|
at_css('.main-content > h1').content[/(.*)( )/, 1].split(' top-level')[0]
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def get_kind
|
|
|
|
|
title = at_css('h1.title')
|
|
|
|
|
|
|
|
|
|
if not title.nil?
|
|
|
|
|
# v1
|
|
|
|
|
title.at_css('.kind').content
|
|
|
|
|
else
|
|
|
|
|
# v2
|
|
|
|
|
at_css('.main-content > h1').content[/(.*)( )(.+)/, 3]
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|