diff --git a/assets/images/docs-2.png b/assets/images/docs-2.png
index 2bd5bdbe..089ecbde 100644
Binary files a/assets/images/docs-2.png and b/assets/images/docs-2.png differ
diff --git a/assets/images/docs-2@2x.png b/assets/images/docs-2@2x.png
index ed34377a..c8234813 100644
Binary files a/assets/images/docs-2@2x.png and b/assets/images/docs-2@2x.png differ
diff --git a/assets/javascripts/news.json b/assets/javascripts/news.json
index 435913f6..ffdb2615 100644
--- a/assets/javascripts/news.json
+++ b/assets/javascripts/news.json
@@ -1,5 +1,8 @@
[
[
+ "2018-08-06",
+ "New documentation: Dart"
+ ], [
"2018-07-29",
"New documentations: Bash, Graphite and Pygame"
], [
diff --git a/assets/stylesheets/global/_icons.scss b/assets/stylesheets/global/_icons.scss
index 5dfb1034..14c12346 100644
--- a/assets/stylesheets/global/_icons.scss
+++ b/assets/stylesheets/global/_icons.scss
@@ -176,3 +176,4 @@
._icon-terraform:before { background-position: -4rem -3rem; @extend %doc-icon-2; }
._icon-pygame:before { background-position: -5rem -3rem; @extend %doc-icon-2; }
._icon-bash:before { background-position: -6rem -3rem; @extend %doc-icon-2; }
+._icon-dart:before { background-position: -7rem -3rem; @extend %doc-icon-2; }
diff --git a/assets/stylesheets/pages/_dart.scss b/assets/stylesheets/pages/_dart.scss
index 87159057..3c011db7 100644
--- a/assets/stylesheets/pages/_dart.scss
+++ b/assets/stylesheets/pages/_dart.scss
@@ -2,11 +2,11 @@
@extend %simple;
dl:not(.dl-horizontal) dt, .multi-line-signature {
- @extend %note, %note-blue;
- padding: 1px 0.5rem 2px 0.5rem;
+ @extend %block-label;
.features {
float: right;
+ color: $textColorLight;
}
}
}
diff --git a/lib/docs/filters/dart/clean_html.rb b/lib/docs/filters/dart/clean_html.rb
index ce1733af..c0021aae 100644
--- a/lib/docs/filters/dart/clean_html.rb
+++ b/lib/docs/filters/dart/clean_html.rb
@@ -4,7 +4,7 @@ module Docs
def call
# Move the title into the main content node in the v1 docs
title = at_css('h1.title')
- unless title.nil?
+ if title
name = title.children.last.content.strip
kind = title.at_css('.kind').content
at_css('.main-content').prepend_child("
#{name} #{kind}
")
@@ -39,11 +39,26 @@ module Docs
header.add_child node unless header.nil?
end
+ css('section').each do |node|
+ if node['id'] && node.first_element_child
+ node.first_element_child['id'] ||= node['id']
+ end
+
+ node.before(node.children).remove
+ end
+
+ css('span').each do |node|
+ node.before(node.children).remove
+ end
+
# Make code blocks detectable by Prism
css('pre').each do |node|
node['data-language'] = 'dart'
+ node.content = node.content
end
+ css('.properties', '.property', '.callables', '.callable').remove_attr('class')
+
doc
end
end
diff --git a/lib/docs/filters/dart/entries.rb b/lib/docs/filters/dart/entries.rb
index f94c451b..f3c42bbf 100644
--- a/lib/docs/filters/dart/entries.rb
+++ b/lib/docs/filters/dart/entries.rb
@@ -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
diff --git a/lib/docs/scrapers/dart.rb b/lib/docs/scrapers/dart.rb
index b06960b2..83ccc1b5 100644
--- a/lib/docs/scrapers/dart.rb
+++ b/lib/docs/scrapers/dart.rb
@@ -11,24 +11,27 @@ module Docs
options[:fix_urls] = ->(url) do
# localhost/dart-web_audio/..dart-io/dart-io-library.html > localhost/dart-io/dart-io-library.html
- url.sub(/(([^\/]+)\/\.\.)/, '')
+ url.remove!(/[^\/]+\/\.\./)
+ url
end
options[:attribution] = <<-HTML
- © 2012, the Dart project authors
+ © 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
HTML
# Download the documentation from https://www.dartlang.org/tools/sdk/archive
- version '1' do
- self.release = '1.24.3'
- self.dir = '/home/jasper/Documents/dart-docs-1.24.3'
+ version '2' do
+ self.release = '2.0.0'
+ self.dir = '/Users/Thibaut/DevDocs/Docs/Dart2'
+ self.base_url = "https://api.dartlang.org/stable/#{release}/"
end
- version '2' do
- self.release = '2.0.0-dev.68.0'
- self.dir = '/home/jasper/Documents/dart-docs-2.0.0-dev.68.0'
+ version '1' do
+ self.release = '1.24.3'
+ self.dir = '/Users/Thibaut/DevDocs/Docs/Dart1'
+ self.base_url = "https://api.dartlang.org/stable/#{release}/"
end
end
end
diff --git a/public/icons/docs-2.pxm b/public/icons/docs-2.pxm
index 37cdd6d7..7039ec5f 100644
Binary files a/public/icons/docs-2.pxm and b/public/icons/docs-2.pxm differ
diff --git a/public/icons/docs-2@2x.pxm b/public/icons/docs-2@2x.pxm
index fcc1aafb..e0dd2df5 100644
Binary files a/public/icons/docs-2@2x.pxm and b/public/icons/docs-2@2x.pxm differ
diff --git a/public/icons/docs/dart/16.png b/public/icons/docs/dart/16.png
index 3272c1d7..82dae43a 100644
Binary files a/public/icons/docs/dart/16.png and b/public/icons/docs/dart/16.png differ
diff --git a/public/icons/docs/dart/16@2x.png b/public/icons/docs/dart/16@2x.png
index cad29d18..c27da76f 100644
Binary files a/public/icons/docs/dart/16@2x.png and b/public/icons/docs/dart/16@2x.png differ