Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 46 KiB |
@ -0,0 +1,12 @@
|
||||
._dart {
|
||||
@extend %simple;
|
||||
|
||||
dl:not(.dl-horizontal) dt, .multi-line-signature {
|
||||
@extend %block-label;
|
||||
|
||||
.features {
|
||||
float: right;
|
||||
color: var(--textColorLight);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
._qt {
|
||||
@extend %simple;
|
||||
|
||||
// Function headers
|
||||
h3.fn > code {
|
||||
float: right;
|
||||
color: var(--textColorLight);
|
||||
}
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
module Docs
|
||||
class Dart
|
||||
class CleanHtmlFilter < Filter
|
||||
def call
|
||||
# Move the title into the main content node in the v1 docs
|
||||
title = at_css('h1.title')
|
||||
if title
|
||||
name = title.children.last.content.strip
|
||||
kind = title.at_css('.kind').content
|
||||
at_css('.main-content').prepend_child("<h1>#{name} #{kind}</h1>")
|
||||
end
|
||||
|
||||
# Add a title to the homepage of the v2 docs
|
||||
if subpath == 'index.html' && at_css('.main-content > h1').nil?
|
||||
at_css('.main-content').prepend_child('<h1>Dart SDK</h1>')
|
||||
end
|
||||
|
||||
# Add the library to the main content (it is not always visible in the menu entry)
|
||||
breadcrumbs = at_css('.breadcrumbs').css('li:not(.self-crumb) > a')
|
||||
if breadcrumbs.length > 1
|
||||
library = breadcrumbs[1].content
|
||||
|
||||
# Generate the link to the homepage of the library
|
||||
with_hypens = library.gsub(/:/, '-')
|
||||
location = "#{'../' * subpath.count('/')}#{with_hypens}/#{with_hypens}-library"
|
||||
link = "<a href=\"#{location}\" class=\"_links-link\">#{library}</span>"
|
||||
|
||||
# Add the link to the main title, just like how the "Homepage" and "Source code" links appear
|
||||
at_css('.main-content').prepend_child("<p class=\"_links\">#{link}</p>")
|
||||
end
|
||||
|
||||
# Extract the actual content
|
||||
# We can't use options[:container] here because the entries filter uses the breadcrumbs node
|
||||
@doc = at_css('.main-content')
|
||||
|
||||
# Move the features (i.e. "read-only, inherited") into the blue header
|
||||
css('.features').each do |node|
|
||||
header = node.xpath('parent::dd/preceding::dt').last
|
||||
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
|
||||
end
|
||||
end
|
@ -0,0 +1,42 @@
|
||||
module Docs
|
||||
class Dart
|
||||
class EntriesFilter < Docs::EntriesFilter
|
||||
def get_name
|
||||
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 = ''
|
||||
|
||||
if breadcrumbs.length == 2 && !kind.include?('class')
|
||||
first_part = breadcrumbs[1].content
|
||||
elsif breadcrumbs.length == 3
|
||||
first_part = breadcrumbs[2].content
|
||||
end
|
||||
|
||||
separator = ''
|
||||
|
||||
unless first_part.empty?
|
||||
if kind.include?('class')
|
||||
separator = ':'
|
||||
else
|
||||
separator = '.'
|
||||
end
|
||||
end
|
||||
|
||||
"#{first_part}#{separator}#{name}"
|
||||
end
|
||||
|
||||
def get_type
|
||||
at_css('.breadcrumbs > li:nth-child(2)').content.split(' ')[0]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,31 @@
|
||||
module Docs
|
||||
class Qt
|
||||
class CleanHtmlFilter < Filter
|
||||
def call
|
||||
# Remove unneeded elements
|
||||
css('.copy-notice, .navigationbar, .headerNavi, .footerNavi, .sidebar, .toc, #ec_toggle', '.landingicons img', 'br').remove
|
||||
|
||||
# QML property/method header
|
||||
css('.qmlproto').each do |node|
|
||||
id = node.at_css('tr')['id']
|
||||
node.inner_html = node.at_css('td').inner_html
|
||||
node.name = 'h3'
|
||||
node['id'] = id
|
||||
end
|
||||
|
||||
css('.main-rounded', '.content', '.line', '.context', '.descr', '.types', '.func', '.table', 'div:not([class])', '.landing', '.col-1', '.heading', '.qmlitem', '.qmldoc', 'div.pre').each do |node|
|
||||
node.before(node.children).remove
|
||||
end
|
||||
|
||||
css('pre').each do |node|
|
||||
node.content = node.content
|
||||
node['data-language'] = 'cpp' if node['class'].include?('cpp')
|
||||
node['data-language'] = 'qml' if node['class'].include?('qml')
|
||||
node.remove_attribute('class')
|
||||
end
|
||||
|
||||
doc
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,37 @@
|
||||
module Docs
|
||||
class Dart < FileScraper
|
||||
self.type = 'dart'
|
||||
self.root_path = 'index.html'
|
||||
self.links = {
|
||||
home: 'https://www.dartlang.org/',
|
||||
code: 'https://github.com/dart-lang/sdk'
|
||||
}
|
||||
|
||||
html_filters.push 'dart/entries', 'dart/clean_html'
|
||||
|
||||
options[:fix_urls] = ->(url) do
|
||||
# localhost/dart-web_audio/..dart-io/dart-io-library.html > localhost/dart-io/dart-io-library.html
|
||||
url.remove!(/[^\/]+\/\.\./)
|
||||
url
|
||||
end
|
||||
|
||||
options[:attribution] = <<-HTML
|
||||
© 2012 the Dart project authors<br>
|
||||
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
|
||||
HTML
|
||||
|
||||
# Download the documentation from https://www.dartlang.org/tools/sdk/archive
|
||||
|
||||
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 '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
|
@ -0,0 +1,121 @@
|
||||
module Docs
|
||||
class Qt < UrlScraper
|
||||
self.name = 'Qt'
|
||||
self.type = 'qt'
|
||||
self.initial_paths = %w(classes.html qmltypes.html)
|
||||
self.root_path = 'index.html'
|
||||
self.links = {
|
||||
home: 'https://www.qt.io',
|
||||
code: 'https://code.qt.io/cgit/'
|
||||
}
|
||||
|
||||
html_filters.push 'qt/entries', 'qt/clean_html'
|
||||
|
||||
options[:container] = '.main'
|
||||
options[:max_image_size] = 156_000
|
||||
options[:skip_patterns] = [
|
||||
# License, copyright attributions
|
||||
/3rdparty/,
|
||||
/attribution/,
|
||||
/license/,
|
||||
/licensing/,
|
||||
|
||||
# Examples, guides, tutorials
|
||||
/example/,
|
||||
/guide$/,
|
||||
/tutorial/,
|
||||
/porting/,
|
||||
/usecase/,
|
||||
/topic/,
|
||||
/^modelview/,
|
||||
/deploy(ing|ment)/,
|
||||
/building/,
|
||||
|
||||
# Old versions, changelog
|
||||
/obsolete/,
|
||||
/compatibility/,
|
||||
/^whatsnew/,
|
||||
/^newclasses/,
|
||||
|
||||
# Deprecated modules
|
||||
/(qtopengl|qgl)/,
|
||||
/qt?script/,
|
||||
|
||||
# Indexes
|
||||
/members/,
|
||||
/module/,
|
||||
/overview/,
|
||||
/^qopenglfunctions/,
|
||||
|
||||
# Tooling
|
||||
/^(qt)?(linguist|assistant|qdbusviewer)/,
|
||||
]
|
||||
|
||||
options[:skip] = [
|
||||
"qt5-intro.html",
|
||||
"compatmap.html",
|
||||
|
||||
# Indexes
|
||||
"classes.html",
|
||||
"qtmodules.html",
|
||||
"modules-qml.html",
|
||||
"modules-cpp.html",
|
||||
"functions.html",
|
||||
"namespaces.html",
|
||||
"qmltypes.html",
|
||||
"qt3d-qml.html",
|
||||
"qmlbasictypes.html",
|
||||
"guibooks.html",
|
||||
"annotated.html",
|
||||
"overviews-main.html",
|
||||
"reference-overview.html",
|
||||
|
||||
# Tutorials
|
||||
"qtvirtualkeyboard-build.html",
|
||||
|
||||
# Copyright
|
||||
"trademarks.html",
|
||||
"lgpl.html",
|
||||
"bughowto.html",
|
||||
|
||||
# Changelogs
|
||||
"changes.html",
|
||||
"qtlocation-changes.html",
|
||||
"sourcebreaks.html",
|
||||
|
||||
# Best practice guides
|
||||
"accessible.html",
|
||||
"accessible-qtquick.html",
|
||||
"sharedlibrary.html",
|
||||
"exceptionsafety.html",
|
||||
"scalability.html",
|
||||
"session.html",
|
||||
"appicon.html",
|
||||
"accelerators.html",
|
||||
|
||||
# Other
|
||||
"ecmascript.html",
|
||||
"qtremoteobjects-interaction.html",
|
||||
]
|
||||
|
||||
options[:attribution] = <<-HTML
|
||||
© The Qt Company Ltd<br>
|
||||
Licensed under the GNU Free Documentation License, Version 1.3.
|
||||
HTML
|
||||
|
||||
version '5.11' do
|
||||
self.release = '5.11'
|
||||
self.base_url = 'https://doc.qt.io/qt-5/'
|
||||
end
|
||||
|
||||
version '5.9' do
|
||||
self.release = '5.9'
|
||||
self.base_url = 'https://doc.qt.io/qt-5.9/'
|
||||
end
|
||||
|
||||
version '5.6' do
|
||||
self.release = '5.6'
|
||||
self.base_url = 'https://doc.qt.io/qt-5.6/'
|
||||
end
|
||||
end
|
||||
end
|
After Width: | Height: | Size: 472 B |
After Width: | Height: | Size: 749 B |
@ -0,0 +1 @@
|
||||
https://github.com/dart-lang/logos
|
After Width: | Height: | Size: 362 B |
After Width: | Height: | Size: 681 B |
@ -0,0 +1 @@
|
||||
https://commons.wikimedia.org/wiki/File:Qt_logo_2016.svg
|