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
3333 # We can't use options[:container] here because the entries filter uses the breadcrumbs node
3434 @doc = at_css('.main-content')
3535
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+
3645 # Move the features (i.e. "read-only, inherited") into the blue header
3746 css('.features').each do |node|
3847 header = node.xpath('parent::dd/preceding::dt').last
3948 header.add_child node unless header.nil?
4049 end
4150
42− css('section').each do |node|
51+ css('section:not(.multi-line-signature)').each do |node|
4352 if node['id'] && node.first_element_child
4453 node.first_element_child['id'] ||= node['id']
4554 end
@@ -54,7 +63,7 @@ module Docs · 8 unmodified lines
5463 # Make code blocks detectable by Prism
5564 css('pre').each do |node|
5665 node['data-language'] = 'dart'
57− node.content = node.content
66+ node.content = node.content.strip
5867 end
5968
6069 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
77 name = title.element_children.last.content.strip
88 kind = title.at_css('.kind').content
99 else # v2
10− title = at_css('.main-content > h1')
10+ title = at_css('.main-content > div > h1')
1111 name = title.content[/(.*)( )/, 1].split(' top-level')[0]
1212 kind = title.content[/(.*)( )(.+)/, 3]
1313 end
@@ -15,7 +15,7 @@ module Docs · 1 unmodified line
1515 breadcrumbs = at_css('.breadcrumbs').css('li:not(.self-crumb) > a')
1616 first_part = ''
1717
18− if breadcrumbs.length == 2 && !kind.include?('class')
18+ if breadcrumbs.length == 2 && kind.blank?
1919 first_part = breadcrumbs[1].content
2020 elsif breadcrumbs.length == 3
2121 first_part = breadcrumbs[2].content
lib/docs/scrapers/dart.rb+4−4
@@ -3,7 +3,7 @@ module Docs · 2 unmodified lines
33 self.type = 'dart'
44 self.root_path = 'index.html'
55 self.links = {
6− home: 'https://www.dartlang.org/',
6+ home: 'https://dart.dev/',
77 code: 'https://github.com/dart-lang/sdk'
88 }
99
@@ -23,13 +23,13 @@ module Docs · 13 unmodified lines
2323 # Download the documentation from https://www.dartlang.org/tools/sdk/archive
2424
2525 version '2' do
26− self.release = '2.0.0'
27− self.base_url = "https://api.dartlang.org/stable/#{release}/"
26+ self.release = '2.5.0'
27+ self.base_url = "https://api.dart.dev/stable/#{release}/"
2828 end
2929
3030 version '1' do
3131 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}/"
3333 end
3434
3535 def get_latest_version(opts)