Merge remote-tracking branch 'upstream/master' into css-variables

pull/858/head
Jed Fox 7 years ago
commit 3ab5f0c3c8

@ -1,5 +1,7 @@
FROM ruby:2.5.1
ENV LANG=C.UTF-8
WORKDIR /devdocs
RUN apt-get update && \

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 46 KiB

@ -149,6 +149,9 @@ class app.Shortcuts
when 40
@trigger 'altDown'
false
when 68
@trigger 'altD'
false
when 70
@trigger 'altF', event
when 71

@ -1,5 +1,8 @@
[
[
"2018-08-12",
"New documentations: <a href=\"/dart/\">Dart</a> and <a href=\"/qt/\">Qt</a>"
], [
"2018-07-29",
"New documentations: <a href=\"/bash/\">Bash</a>, <a href=\"/graphite/\">Graphite</a> and <a href=\"/pygame/\">Pygame</a>"
], [

@ -215,6 +215,11 @@ credits = [
'2010-2018 Michael Bostock',
'BSD',
'https://raw.githubusercontent.com/d3/d3/master/LICENSE'
], [
'Dart',
'2012 the Dart project authors',
'CC BY-SA',
'https://creativecommons.org/licenses/by-sa/4.0/'
], [
'Django',
'Django Software Foundation and individual contributors',
@ -570,6 +575,11 @@ credits = [
'2009-2017 Kristopher Michael Kowal',
'MIT',
'https://raw.githubusercontent.com/kriskowal/q/master/LICENSE'
], [
'Qt',
'2012-2018 The Qt Company Ltd',
'GFDL',
'https://doc.qt.io/qt-5/licensing.html'
], [
'Ramda',
'2013-2016 Scott Sauyet and Michael Hurley',

@ -131,6 +131,9 @@ app.templates.helpPage = ->
<dt class="_shortcuts-dt">
<code class="_shortcut-code">alt + s</code>
<dd class="_shortcuts-dd">Search on Stack Overflow
<dt class="_shortcuts-dt">
<code class="_shortcut-code">alt + d</code>
<dd class="_shortcuts-dd">Search on DuckDuckGo
</dl>
<p class="_note _note-green">
<strong>Tip:</strong> If the cursor is no longer in the search field, press <code class="_label">/</code> or

File diff suppressed because one or more lines are too long

@ -17,6 +17,7 @@ class app.views.Search extends app.View
typing: 'focus'
altG: 'google'
altS: 'stackoverflow'
altD: 'duckduckgo'
@routes:
after: 'afterRoute'
@ -113,6 +114,10 @@ class app.views.Search extends app.View
@externalSearch "https://stackoverflow.com/search?q="
return
duckduckgo: =>
@externalSearch "https://duckduckgo.com/?t=devdocs&q="
return
onResults: (results) =>
@hasResults = true if results.length
@trigger 'results', results, @flags

@ -48,6 +48,7 @@
'pages/crystal',
'pages/d',
'pages/d3',
'pages/dart',
'pages/dojo',
'pages/drupal',
'pages/elixir',
@ -84,6 +85,7 @@
'pages/postgres',
'pages/pug',
'pages/python',
'pages/qt',
'pages/ramda',
'pages/rdoc',
'pages/react_native',

@ -176,3 +176,5 @@ html._theme-dark {
._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; }
._icon-qt:before { background-position: -8rem -3rem; @extend %doc-icon-2; }

@ -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,141 @@
# frozen_string_literal: true
module Docs
class Qt
class EntriesFilter < Docs::EntriesFilter
def get_name
header = at_css('h1.title + .small-subtitle a') || at_css('h1.title') || at_css('.context h2')
name = header.content
name.sub! %r{ Class$}, ' (class)'
name.sub! %r{ QML Type$}, ' (QML type)'
name.sub! %r{ QML Basic Type$}, ' (QML basic type)'
# Add '(class)' to the class pages where the subtitle name is used (e.g. qset-const-iterator.html)
if at_css('h1.title').content.strip.end_with?(' Class') && !name.include?('(class)')
name = "#{name} (class) "
end
name
end
def get_type
breadcrumb = css('#main_title_bar + ul li')
category = if breadcrumb.length < 3
then 'Qt'.dup
else breadcrumb.at(1).content
end
if category == 'Qt'
return 'Qt Platforms' if name.include?(' for ') || name == 'Qt Platform Abstraction'
return 'Qt Quick' if name == 'Qt Quick Test' || name == 'Qt Quick Test Reference Documentation'
alwaysInQt = ['Qt Configure Options', 'Qt Image Formats']
category = name if name.start_with?('Qt ') && !alwaysInQt.include?(name)
end
qtPlatformsTypes = ['Qt Platform Headers', 'Qt Android Extras', 'Qt Mac Extras', 'Qt Windows Extras', 'Qt X11 Extras']
return 'Qt Platforms' if qtPlatformsTypes.include?(category)
category.remove!(' Manual')
category
end
def include_default_entry?
name != 'All Classes' && name != 'All QML Types'
end
def additional_entries
entries = []
titles = []
className = at_css('h1.title').content.strip.remove(' Class')
displayedClassName = className
alternativeClassName = at_css('h1.title + .small-subtitle a')
displayedClassName = alternativeClassName.content if alternativeClassName
# Functions signatures
css('h3.fn').each do |node|
header = node.clone
# Skip typenames
next if header.content.strip.start_with?('typename ')
# Remove leading <a name="">
header.children.css('a[name]').remove
# Remove leading <code> tag (virtual/static/… attributes)
code = header.children.first
code.remove if code.name == 'code'
# Remove leading const
header.children.first.remove if header.content.strip.start_with?('const ')
# Remove return type
returnType = header.children.first
returnType.remove if returnType['class'] == 'type'
title = header.content.strip
# Remove leading '&'/'*'
title[0] = '' if title[0] == '&' || title[0] == '*'
# Ignore operator overloads
next if title.start_with?('operator')
# Remove function parameters
title.sub! %r{\(.*\)}, '()'
# Remove template generics
title.remove!(%r{^<.*> })
# Remove const at the end
title.remove!(%r{ const$})
# Enum/typedef formatting
title.sub! %r{(enum|typedef) (.*)}, '\2 (\1)'
# Remove property type
title = "#{displayedClassName}::#{title}" if title.sub!(%r{ : .*$}, '')
# Replace the class name by the alternative class name if available
title = title.sub(className, displayedClassName) if alternativeClassName
unless titles.include?(title) # Remove duplicates (function overloading)
entries << [title, header['id']]
titles.push title
end
end
# QML properties/functions
qmlTypeName = at_css('h1.title').content.remove(' QML Type', '')
css('.qmlproto').each do |node|
title = node.content.strip
id = node.at_css('tr')['id']
# Remove options
title.remove!(%r{^\[.*\] })
# Remove function parameters
title.sub! %r{\(.*\)}, '()'
# Remove property type
title.remove!(%r{ : .*$})
# Remove return type
title.remove!(%r{.* })
# Remove return type
title.remove!(%r{.* })
title = "#{qmlTypeName}.#{title.strip}"
unless titles.include?(title) # Remove duplicates (function overloading)
entries << [title, id]
titles.push(title)
end
end
entries
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
&copy; 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
&copy; 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

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 472 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 749 B

@ -0,0 +1 @@
https://github.com/dart-lang/logos

Binary file not shown.

After

Width:  |  Height:  |  Size: 362 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 681 B

@ -0,0 +1 @@
https://commons.wikimedia.org/wiki/File:Qt_logo_2016.svg
Loading…
Cancel
Save