Unified · Split
| @@ -215,6 +215,11 @@ credits = [ · 214 unmodified lines | |||
| 215 | '2010-2018 Michael Bostock', | 215 | '2010-2018 Michael Bostock', |
| 216 | 'BSD', | 216 | 'BSD', |
| 217 | 'https://raw.githubusercontent.com/d3/d3/master/LICENSE' | 217 | 'https://raw.githubusercontent.com/d3/d3/master/LICENSE' |
| 218 | ], [ | ||
| 219 | 'Dart', | ||
| 220 | '2012 the Dart project authors', | ||
| 221 | 'CC BY-SA', | ||
| 222 | 'https://creativecommons.org/licenses/by-sa/4.0/' | ||
| 218 | ], [ | 223 | ], [ |
| 219 | 'Django', | 224 | 'Django', |
| 220 | 'Django Software Foundation and individual contributors', | 225 | 'Django Software Foundation and individual contributors', |
| @@ -2113,3 +2113,27 @@ Prism.languages.yaml = { · 2112 unmodified lines | |||
| 2113 | 'punctuation': /---|[:[\]{}\-,|>?]|\.\.\./ | 2113 | 'punctuation': /---|[:[\]{}\-,|>?]|\.\.\./ |
| 2114 | }; | 2114 | }; |
| 2115 | 2115 | ||
| 2116 | Prism.languages.dart = Prism.languages.extend('clike', { | ||
| 2117 | 'string': [ | ||
| 2118 | { | ||
| 2119 | pattern: /r?("""|''')[\s\S]*?\1/, | ||
| 2120 | greedy: true | ||
| 2121 | }, | ||
| 2122 | { | ||
| 2123 | pattern: /r?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/, | ||
| 2124 | greedy: true | ||
| 2125 | } | ||
| 2126 | ], | ||
| 2127 | 'keyword': [ | ||
| 2128 | /\b(?:async|sync|yield)\*/, | ||
| 2129 | /\b(?:abstract|assert|async|await|break|case|catch|class|const|continue|default|deferred|do|dynamic|else|enum|export|external|extends|factory|final|finally|for|get|if|implements|import|in|library|new|null|operator|part|rethrow|return|set|static|super|switch|this|throw|try|typedef|var|void|while|with|yield)\b/ | ||
| 2130 | ], | ||
| 2131 | 'operator': /\bis!|\b(?:as|is)\b|\+\+|--|&&|\|\||<<=?|>>=?|~(?:\/=?)?|[+\-*\/%&^|=!<>]=?|\?/ | ||
| 2132 | }); | ||
| 2133 | |||
| 2134 | Prism.languages.insertBefore('dart','function',{ | ||
| 2135 | 'metadata': { | ||
| 2136 | pattern: /@\w+/, | ||
| 2137 | alias: 'symbol' | ||
| 2138 | } | ||
| 2139 | }); | ||
| @@ -46,6 +46,7 @@ · 45 unmodified lines | |||
| 46 | 'pages/crystal', | 46 | 'pages/crystal', |
| 47 | 'pages/d', | 47 | 'pages/d', |
| 48 | 'pages/d3', | 48 | 'pages/d3', |
| 49 | 'pages/dart', | ||
| 49 | 'pages/dojo', | 50 | 'pages/dojo', |
| 50 | 'pages/drupal', | 51 | 'pages/drupal', |
| 51 | 'pages/elixir', | 52 | 'pages/elixir', |
| @@ -46,6 +46,7 @@ · 45 unmodified lines | |||
| 46 | 'pages/crystal', | 46 | 'pages/crystal', |
| 47 | 'pages/d', | 47 | 'pages/d', |
| 48 | 'pages/d3', | 48 | 'pages/d3', |
| 49 | 'pages/dart', | ||
| 49 | 'pages/dojo', | 50 | 'pages/dojo', |
| 50 | 'pages/drupal', | 51 | 'pages/drupal', |
| 51 | 'pages/elixir', | 52 | 'pages/elixir', |
| @@ -0,0 +1,12 @@ | |||
| 1 | ._dart { | ||
| 2 | @extend %simple; | ||
| 3 | |||
| 4 | dl:not(.dl-horizontal) dt, .multi-line-signature { | ||
| 5 | @extend %note, %note-blue; | ||
| 6 | padding: 1px 0.5rem 2px 0.5rem; | ||
| 7 | |||
| 8 | .features { | ||
| 9 | float: right; | ||
| 10 | } | ||
| 11 | } | ||
| 12 | } | ||
| @@ -0,0 +1,51 @@ | |||
| 1 | module Docs | ||
| 2 | class Dart | ||
| 3 | class CleanHtmlFilter < Filter | ||
| 4 | def call | ||
| 5 | # Move the title into the main content node in the v1 docs | ||
| 6 | title = at_css('h1.title') | ||
| 7 | unless title.nil? | ||
| 8 | name = title.children.last.content.strip | ||
| 9 | kind = title.at_css('.kind').content | ||
| 10 | at_css('.main-content').prepend_child("<h1>#{name} #{kind}</h1>") | ||
| 11 | end | ||
| 12 | |||
| 13 | # Add a title to the homepage of the v2 docs | ||
| 14 | if subpath == 'index.html' && at_css('.main-content > h1').nil? | ||
| 15 | at_css('.main-content').prepend_child('<h1>Dart SDK</h1>') | ||
| 16 | end | ||
| 17 | |||
| 18 | # Add the library to the main content (it is not always visible in the menu entry) | ||
| 19 | breadcrumbs = at_css('.breadcrumbs').css('li:not(.self-crumb) > a') | ||
| 20 | if breadcrumbs.length > 1 | ||
| 21 | library = breadcrumbs[1].content | ||
| 22 | |||
| 23 | # Generate the link to the homepage of the library | ||
| 24 | with_hypens = library.gsub(/:/, '-') | ||
| 25 | location = "#{'../' * subpath.count('/')}#{with_hypens}/#{with_hypens}-library" | ||
| 26 | link = "<a href=\"#{location}\" class=\"_links-link\">#{library}</span>" | ||
| 27 | |||
| 28 | # Add the link to the main title, just like how the "Homepage" and "Source code" links appear | ||
| 29 | at_css('.main-content').prepend_child("<p class=\"_links\">#{link}</p>") | ||
| 30 | end | ||
| 31 | |||
| 32 | # Extract the actual content | ||
| 33 | # We can't use options[:container] here because the entries filter uses the breadcrumbs node | ||
| 34 | @doc = at_css('.main-content') | ||
| 35 | |||
| 36 | # Move the features (i.e. "read-only, inherited") into the blue header | ||
| 37 | css('.features').each do |node| | ||
| 38 | header = node.xpath('parent::dd/preceding::dt').last | ||
| 39 | header.add_child node unless header.nil? | ||
| 40 | end | ||
| 41 | |||
| 42 | # Make code blocks detectable by Prism | ||
| 43 | css('pre').each do |node| | ||
| 44 | node['data-language'] = 'dart' | ||
| 45 | end | ||
| 46 | |||
| 47 | doc | ||
| 48 | end | ||
| 49 | end | ||
| 50 | end | ||
| 51 | end | ||
| @@ -0,0 +1,58 @@ | |||
| 1 | module Docs | ||
| 2 | class Dart | ||
| 3 | class EntriesFilter < Docs::EntriesFilter | ||
| 4 | def get_name | ||
| 5 | title = get_title | ||
| 6 | kind = get_kind | ||
| 7 | |||
| 8 | breadcrumbs = at_css('.breadcrumbs').css('li:not(.self-crumb) > a') | ||
| 9 | first_part = '' | ||
| 10 | |||
| 11 | if breadcrumbs.length == 2 && !kind.include?('class') | ||
| 12 | first_part = breadcrumbs[1].content | ||
| 13 | elsif breadcrumbs.length == 3 | ||
| 14 | first_part = breadcrumbs[2].content | ||
| 15 | end | ||
| 16 | |||
| 17 | separator = '' | ||
| 18 | unless first_part.empty? | ||
| 19 | if kind.include?('class') | ||
| 20 | separator = ':' | ||
| 21 | else | ||
| 22 | separator = '.' | ||
| 23 | end | ||
| 24 | end | ||
| 25 | |||
| 26 | first_part + separator + title | ||
| 27 | end | ||
| 28 | |||
| 29 | def get_type | ||
| 30 | at_css('.breadcrumbs > li:nth-child(2)').content.split(' ')[0] | ||
| 31 | end | ||
| 32 | |||
| 33 | def get_title | ||
| 34 | title = at_css('h1.title') | ||
| 35 | |||
| 36 | if not title.nil? | ||
| 37 | # v1 | ||
| 38 | title.children.last.content.strip | ||
| 39 | else | ||
| 40 | # v2 | ||
| 41 | at_css('.main-content > h1').content[/(.*)( )/, 1].split(' top-level')[0] | ||
| 42 | end | ||
| 43 | end | ||
| 44 | |||
| 45 | def get_kind | ||
| 46 | title = at_css('h1.title') | ||
| 47 | |||
| 48 | if not title.nil? | ||
| 49 | # v1 | ||
| 50 | title.at_css('.kind').content | ||
| 51 | else | ||
| 52 | # v2 | ||
| 53 | at_css('.main-content > h1').content[/(.*)( )(.+)/, 3] | ||
| 54 | end | ||
| 55 | end | ||
| 56 | end | ||
| 57 | end | ||
| 58 | end | ||
| @@ -0,0 +1,34 @@ | |||
| 1 | module Docs | ||
| 2 | class Dart < FileScraper | ||
| 3 | self.type = 'dart' | ||
| 4 | self.root_path = 'index.html' | ||
| 5 | self.links = { | ||
| 6 | home: 'https://www.dartlang.org/', | ||
| 7 | code: 'https://github.com/dart-lang/sdk' | ||
| 8 | } | ||
| 9 | |||
| 10 | html_filters.push 'dart/entries', 'dart/clean_html' | ||
| 11 | |||
| 12 | options[:fix_urls] = ->(url) do | ||
| 13 | # localhost/dart-web_audio/..dart-io/dart-io-library.html > localhost/dart-io/dart-io-library.html | ||
| 14 | url.sub(/(([^\/]+)\/\.\.)/, '') | ||
| 15 | end | ||
| 16 | |||
| 17 | options[:attribution] = <<-HTML | ||
| 18 | © 2012, the Dart project authors<br> | ||
| 19 | Licensed under the Creative Commons Attribution-ShareAlike License v4.0. | ||
| 20 | HTML | ||
| 21 | |||
| 22 | # Download the documentation from https://www.dartlang.org/tools/sdk/archive | ||
| 23 | |||
| 24 | version '1' do | ||
| 25 | self.release = '1.24.3' | ||
| 26 | self.dir = '/home/jasper/Documents/dart-docs-1.24.3' | ||
| 27 | end | ||
| 28 | |||
| 29 | version '2' do | ||
| 30 | self.release = '2.0.0-dev.68.0' | ||
| 31 | self.dir = '/home/jasper/Documents/dart-docs-2.0.0-dev.68.0' | ||
| 32 | end | ||
| 33 | end | ||
| 34 | end | ||
Binary file not shown.
Binary file not shown.
| @@ -0,0 +1 @@ | |||
| 1 | https://github.com/dart-lang/logos | ||