History

Update Dart documentation (2.5.0)

Jasper van Merle committed 7 years ago

Commit 2d98f0c1 parent 8cebb3d3 files · +17 −8Browse files

Unified · Split

3 files
  1. lib/docs/filters/dart/clean_html.rb +11 −2
  2. lib/docs/filters/dart/entries.rb +2 −2
  3. lib/docs/scrapers/dart.rb +4 −4
lib/docs/filters/dart/clean_html.rb+11−2
@@ -33,13 +33,22 @@ module Docs · 32 unmodified lines
33 # We can't use options[:container] here because the entries filter uses the breadcrumbs node33 # We can't use options[:container] here because the entries filter uses the breadcrumbs node
34 @doc = at_css('.main-content')34 @doc = at_css('.main-content')
35 35
36 # Remove external links
37 css('#external-links').remove
38
39 # Properly format header in v2 docs
40 nested_title = at_css('div > h1')
41 unless nested_title.nil?
42 nested_title.parent.replace nested_title
43 end
44
36 # Move the features (i.e. "read-only, inherited") into the blue header45 # Move the features (i.e. "read-only, inherited") into the blue header
37 css('.features').each do |node|46 css('.features').each do |node|
38 header = node.xpath('parent::dd/preceding::dt').last47 header = node.xpath('parent::dd/preceding::dt').last
39 header.add_child node unless header.nil?48 header.add_child node unless header.nil?
40 end49 end
41 50
42 css('section').each do |node|51 css('section:not(.multi-line-signature)').each do |node|
43 if node['id'] && node.first_element_child52 if node['id'] && node.first_element_child
44 node.first_element_child['id'] ||= node['id']53 node.first_element_child['id'] ||= node['id']
45 end54 end
@@ -54,7 +63,7 @@ module Docs · 8 unmodified lines
54 # Make code blocks detectable by Prism63 # Make code blocks detectable by Prism
55 css('pre').each do |node|64 css('pre').each do |node|
56 node['data-language'] = 'dart'65 node['data-language'] = 'dart'
57 node.content = node.content66 node.content = node.content.strip
58 end67 end
59 68
60 css('.properties', '.property', '.callables', '.callable').remove_attr('class')69 css('.properties', '.property', '.callables', '.callable').remove_attr('class')
lib/docs/filters/dart/entries.rb+2−2
@@ -7,7 +7,7 @@ module Docs · 6 unmodified lines
7 name = title.element_children.last.content.strip7 name = title.element_children.last.content.strip
8 kind = title.at_css('.kind').content8 kind = title.at_css('.kind').content
9 else # v29 else # v2
10 title = at_css('.main-content > h1')10 title = at_css('.main-content > div > h1')
11 name = title.content[/(.*)( )/, 1].split(' top-level')[0]11 name = title.content[/(.*)( )/, 1].split(' top-level')[0]
12 kind = title.content[/(.*)( )(.+)/, 3]12 kind = title.content[/(.*)( )(.+)/, 3]
13 end13 end
@@ -15,7 +15,7 @@ module Docs · 1 unmodified line
15 breadcrumbs = at_css('.breadcrumbs').css('li:not(.self-crumb) > a')15 breadcrumbs = at_css('.breadcrumbs').css('li:not(.self-crumb) > a')
16 first_part = ''16 first_part = ''
17 17
18 if breadcrumbs.length == 2 && !kind.include?('class')18 if breadcrumbs.length == 2 && kind.blank?
19 first_part = breadcrumbs[1].content19 first_part = breadcrumbs[1].content
20 elsif breadcrumbs.length == 320 elsif breadcrumbs.length == 3
21 first_part = breadcrumbs[2].content21 first_part = breadcrumbs[2].content
lib/docs/scrapers/dart.rb+4−4
@@ -3,7 +3,7 @@ module Docs · 2 unmodified lines
3 self.type = 'dart'3 self.type = 'dart'
4 self.root_path = 'index.html'4 self.root_path = 'index.html'
5 self.links = {5 self.links = {
6 home: 'https://www.dartlang.org/',6 home: 'https://dart.dev/',
7 code: 'https://github.com/dart-lang/sdk'7 code: 'https://github.com/dart-lang/sdk'
8 }8 }
9 9
@@ -23,13 +23,13 @@ module Docs · 13 unmodified lines
23 # Download the documentation from https://www.dartlang.org/tools/sdk/archive23 # Download the documentation from https://www.dartlang.org/tools/sdk/archive
24 24
25 version '2' do25 version '2' do
26 self.release = '2.0.0'26 self.release = '2.5.0'
27 self.base_url = "https://api.dartlang.org/stable/#{release}/"27 self.base_url = "https://api.dart.dev/stable/#{release}/"
28 end28 end
29 29
30 version '1' do30 version '1' do
31 self.release = '1.24.3'31 self.release = '1.24.3'
32 self.base_url = "https://api.dartlang.org/stable/#{release}/"32 self.base_url = "https://api.dart.dev/stable/#{release}/"
33 end33 end
34 34
35 def get_latest_version(opts)35 def get_latest_version(opts)