diff --git a/Gemfile.lock b/Gemfile.lock
index 9913765b..0f2d1325 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -28,7 +28,7 @@ GEM
ffi (1.9.25)
fspath (3.1.0)
highline (1.7.10)
- html-pipeline (2.8.0)
+ html-pipeline (2.8.3)
activesupport (>= 2)
nokogiri (>= 1.4)
i18n (1.0.1)
@@ -50,7 +50,7 @@ GEM
multi_json (1.13.1)
mustermann (1.0.2)
newrelic_rpm (5.2.0.345)
- nokogiri (1.8.2)
+ nokogiri (1.8.4)
mini_portile2 (~> 2.3.0)
options (2.3.2)
progress (3.4.0)
@@ -88,7 +88,7 @@ GEM
rack-protection (= 2.0.3)
sinatra (= 2.0.3)
tilt (>= 1.3, < 3)
- sprockets (3.7.1)
+ sprockets (3.7.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-helpers (1.2.1)
@@ -113,7 +113,7 @@ GEM
ethon (>= 0.9.0)
tzinfo (1.2.5)
thread_safe (~> 0.1)
- uglifier (4.1.11)
+ uglifier (4.1.14)
execjs (>= 0.3.0, < 3)
unicode-display_width (1.3.3)
unicode_utils (1.4.0)
diff --git a/assets/images/docs-2.png b/assets/images/docs-2.png
index a1758a0e..d096eaa2 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 b2d719c2..961063eb 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 40ded15e..37bba8ec 100644
--- a/assets/javascripts/news.json
+++ b/assets/javascripts/news.json
@@ -1,7 +1,10 @@
[
[
+ "2018-07-08",
+ "New documentations: Leaflet, Terraform and Koa"
+ ], [
"2018-03-26",
- "DevDocs is joining the freeCodeCamp community. Read the announcement here."
+ "DevDocs is joining the freeCodeCamp community. Read the announcement here."
], [
"2018-02-04",
"New documentations: Babel, Jekyll and JSDoc"
diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee
index 35905385..fef9a024 100644
--- a/assets/javascripts/templates/pages/about_tmpl.coffee
+++ b/assets/javascripts/templates/pages/about_tmpl.coffee
@@ -365,6 +365,11 @@ credits = [
'Steven Sanderson, the Knockout.js team, and other contributors',
'MIT',
'https://raw.githubusercontent.com/knockout/knockout/master/LICENSE'
+ ], [
+ 'Koa',
+ '2018 Koa contributors',
+ 'MIT',
+ 'https://raw.githubusercontent.com/koajs/koa/master/LICENSE'
], [
'Kotlin',
'2010-2018 JetBrains s.r.o.',
@@ -375,6 +380,11 @@ credits = [
'Taylor Otwell',
'MIT',
'https://raw.githubusercontent.com/laravel/framework/master/LICENSE.txt'
+ ], [
+ 'Leaflet',
+ '2010-2018 Vladimir Agafonkin
© 2010-2011, CloudMade
Maps © OpenStreetMap contributors.',
+ 'BSD',
+ 'https://raw.githubusercontent.com/Leaflet/Leaflet/master/LICENSE'
], [
'Less',
'2009-2016 The Core Less Team',
@@ -553,8 +563,8 @@ credits = [
], [
'React, React Native, Flow, Relay',
'2013-present Facebook Inc.',
- 'CC BY',
- 'https://raw.githubusercontent.com/reactjs/reactjs.org/master/LICENSE-DOCS.md'
+ 'MIT',
+ 'https://raw.githubusercontent.com/facebook/react/master/LICENSE'
], [
'Redis',
'2009-2018 Salvatore Sanfilippo',
@@ -640,6 +650,11 @@ credits = [
'2018 The TensorFlow Authors',
'CC BY',
'https://creativecommons.org/licenses/by/3.0/'
+ ], [
+ 'Terraform',
+ '2018 HashiCorp',
+ 'MPL',
+ 'https://raw.githubusercontent.com/hashicorp/terraform-website/master/LICENSE.md'
], [
'Twig',
'2009-2017 The Twig Team',
diff --git a/assets/javascripts/views/content/content.coffee b/assets/javascripts/views/content/content.coffee
index 7cf99409..8c5ba874 100644
--- a/assets/javascripts/views/content/content.coffee
+++ b/assets/javascripts/views/content/content.coffee
@@ -19,7 +19,10 @@ class app.views.Content extends app.View
after: 'afterRoute'
init: ->
- @scrollEl = if app.isMobile() then document.body else @el
+ @scrollEl = if app.isMobile()
+ (document.scrollingElement || document.body)
+ else
+ @el
@scrollMap = {}
@scrollStack = []
diff --git a/assets/stylesheets/application-dark.css.scss b/assets/stylesheets/application-dark.css.scss
index c8dc1f8f..4500f90f 100644
--- a/assets/stylesheets/application-dark.css.scss
+++ b/assets/stylesheets/application-dark.css.scss
@@ -79,6 +79,7 @@
'pages/phpunit',
'pages/postgres',
'pages/pug',
+ 'pages/python',
'pages/ramda',
'pages/rdoc',
'pages/react_native',
@@ -95,6 +96,7 @@
'pages/support_tables',
'pages/tcl_tk',
'pages/tensorflow',
+ 'pages/terraform',
'pages/underscore',
'pages/vue',
'pages/webpack',
diff --git a/assets/stylesheets/application.css.scss b/assets/stylesheets/application.css.scss
index 26e0b885..f7321135 100644
--- a/assets/stylesheets/application.css.scss
+++ b/assets/stylesheets/application.css.scss
@@ -79,6 +79,7 @@
'pages/phpunit',
'pages/postgres',
'pages/pug',
+ 'pages/python',
'pages/ramda',
'pages/rdoc',
'pages/react_native',
@@ -95,6 +96,7 @@
'pages/support_tables',
'pages/tcl_tk',
'pages/tensorflow',
+ 'pages/terraform',
'pages/underscore',
'pages/vue',
'pages/webpack',
diff --git a/assets/stylesheets/global/_icons.scss b/assets/stylesheets/global/_icons.scss
index a4ae5bf1..d7e24591 100644
--- a/assets/stylesheets/global/_icons.scss
+++ b/assets/stylesheets/global/_icons.scss
@@ -93,6 +93,7 @@
._icon-svg:before { background-position: -5rem -5rem; }
._icon-marionette:before { background-position: -6rem -5rem; }
._icon-jsdoc:before,
+._icon-koa:before,
._icon-mongoose:before { background-position: -7rem -5rem; }
._icon-phpunit:before { background-position: -8rem -5rem; }
._icon-nokogiri:before { background-position: -9rem -5rem; @extend %darkIconFix !optional; }
@@ -170,3 +171,5 @@
._icon-homebrew:before { background-position: 0 -3rem; @extend %doc-icon-2; }
._icon-jekyll:before { background-position: -1rem -3rem; @extend %doc-icon-2; }
._icon-babel:before { background-position: -2rem -3rem; @extend %doc-icon-2; }
+._icon-leaflet:before { background-position: -3rem -3rem; @extend %doc-icon-2; }
+._icon-terraform:before { background-position: -4rem -3rem; @extend %doc-icon-2; }
diff --git a/assets/stylesheets/pages/_python.scss b/assets/stylesheets/pages/_python.scss
new file mode 100644
index 00000000..78f2d4db
--- /dev/null
+++ b/assets/stylesheets/pages/_python.scss
@@ -0,0 +1,6 @@
+._python {
+ @extend %sphinx;
+
+ h2 > a, h3 > a, dt[id] > a.external, dt[id] > a.internal { float: none !important; }
+ }
+
diff --git a/assets/stylesheets/pages/_terraform.scss b/assets/stylesheets/pages/_terraform.scss
new file mode 100644
index 00000000..6b3123aa
--- /dev/null
+++ b/assets/stylesheets/pages/_terraform.scss
@@ -0,0 +1,4 @@
+._terraform {
+ @extend %simple;
+ .note, .alert { @extend %note; }
+}
diff --git a/lib/docs/filters/crystal/clean_html.rb b/lib/docs/filters/crystal/clean_html.rb
index 3cfa0174..94f3f253 100644
--- a/lib/docs/filters/crystal/clean_html.rb
+++ b/lib/docs/filters/crystal/clean_html.rb
@@ -16,7 +16,7 @@ module Docs
end
def api
- @doc = at_css('#main-content')
+ @doc = at_css('.main-content')
at_css('h1 + p').remove if root_page?
diff --git a/lib/docs/filters/crystal/entries.rb b/lib/docs/filters/crystal/entries.rb
index a2449e19..3a54e3c6 100644
--- a/lib/docs/filters/crystal/entries.rb
+++ b/lib/docs/filters/crystal/entries.rb
@@ -32,7 +32,7 @@ module Docs
if hierarchy && hierarchy.content.include?('Exception')
'Exceptions'
else
- type = at_css('#types-list > ul > .current > a').content
+ type = at_css('.types-list > ul > .current > a').content
type = 'Float' if type.start_with?('Float')
type = 'Int' if type.start_with?('Int')
type = 'UInt' if type.start_with?('UInt')
diff --git a/lib/docs/filters/dom/entries.rb b/lib/docs/filters/dom/entries.rb
index 6d2e2ce3..305b32a3 100644
--- a/lib/docs/filters/dom/entries.rb
+++ b/lib/docs/filters/dom/entries.rb
@@ -55,6 +55,7 @@ module Docs
'Web Workers' => 'Web Workers',
'WebGL' => 'WebGL',
'WebRTC' => 'WebRTC',
+ 'WebUSB' => 'WebUSB',
'WebVR' => 'WebVR' }
TYPE_BY_NAME_STARTS_WITH = {
@@ -126,6 +127,7 @@ module Docs
'URL' => 'URL',
'VR' => 'WebVR',
'WebSocket' => 'Web Sockets',
+ 'USB' => 'WebUSB',
'window' => 'Window',
'Window' => 'Window',
'XMLHttpRequest' => 'XMLHTTPRequest' }
diff --git a/lib/docs/filters/github/clean_html.rb b/lib/docs/filters/github/clean_html.rb
index 80c8ea99..4d6da240 100644
--- a/lib/docs/filters/github/clean_html.rb
+++ b/lib/docs/filters/github/clean_html.rb
@@ -9,7 +9,7 @@ module Docs
css('.highlight > pre').each do |node|
node['data-language'] = node.parent['class'][/highlight-source-(\w+)/, 1]
- node.content = node.content.strip_heredoc.gsub(' ', ' ')
+ node.content = node.content.strip_heredoc
node.parent.replace(node)
end
diff --git a/lib/docs/filters/jest/clean_html.rb b/lib/docs/filters/jest/clean_html.rb
index 394316b6..d1ced3f3 100644
--- a/lib/docs/filters/jest/clean_html.rb
+++ b/lib/docs/filters/jest/clean_html.rb
@@ -12,12 +12,13 @@ module Docs
node.before(node.children).remove
end
- css('.anchor[name]').each do |node|
- node.parent['id'] = node['name']
+ css('.anchor').each do |node|
+ node.parent['id'] = node['id']
node.remove
end
css('pre').each do |node|
+ node['data-language'] = 'js'
node['data-language'] = node['class'][/language-(\w+)/, 1] if node['class']
node.content = node.content
end
diff --git a/lib/docs/filters/jest/entries.rb b/lib/docs/filters/jest/entries.rb
index e90f51ca..f87e4f77 100644
--- a/lib/docs/filters/jest/entries.rb
+++ b/lib/docs/filters/jest/entries.rb
@@ -6,7 +6,7 @@ module Docs
end
def get_type
- type = at_css('.navItemActive').ancestors('.navGroup').first.at_css('h3').content
+ type = at_css('.navListItemActive').ancestors('.navGroup').first.at_css('h3').content
if type == 'Introduction'
'Guides: Introduction'
diff --git a/lib/docs/filters/koa/clean_html.rb b/lib/docs/filters/koa/clean_html.rb
new file mode 100644
index 00000000..7fbbdcfe
--- /dev/null
+++ b/lib/docs/filters/koa/clean_html.rb
@@ -0,0 +1,42 @@
+# frozen_string_literal: true
+
+module Docs
+ class Koa
+ class CleanHtmlFilter < Filter
+ def call
+ fix_homepage if slug.start_with? 'api/index'
+
+ css('[data-language=shell]').each do |node|
+ node['data-language'] = 'bash'
+ end
+
+ doc
+ end
+
+ def fix_homepage
+ # Shrink the headers
+ for n in (1..5).to_a.reverse
+ css("h#{n}").each do |header|
+ header.name = "h#{n+1}"
+ end
+ end
+
+ # Add an introduction
+ doc.children.before <<-HTML.strip_heredoc
+
+ Expressive HTTP middleware framework for node.js to make web applications and APIs more enjoyable to write. Koa's middleware stack flows in a stack-like manner, allowing you to perform actions downstream then filter and manipulate the response upstream. +
++ Only methods that are common to nearly all HTTP servers are integrated directly into Koa's small ~570 SLOC codebase. This includes things like content negotiation, normalization of node inconsistencies, redirection, and a few others. +
++ Koa is not bundled with any middleware. +
+ HTML + end + end + end +end diff --git a/lib/docs/filters/koa/entries.rb b/lib/docs/filters/koa/entries.rb new file mode 100644 index 00000000..6e237371 --- /dev/null +++ b/lib/docs/filters/koa/entries.rb @@ -0,0 +1,36 @@ +module Docs + class Koa + class EntriesFilter < Docs::EntriesFilter + @root_type = 'Koa' + def get_name + at_css('h1').content + end + + def additional_entries + return [] unless slug.match?(/^api/) + type = get_name + css('h2, h3').to_a + .delete_if do |node| + node.content == 'API' || + (slug.include?('index') && !node.content.include?('.')) + end + .map do |node| + name = node.content.strip.sub(/\(.*\)\z/, '()') + type = 'API' if type == @root_type && name.include?('.') + [name, node['id'], type] + end + end + + def get_type + case slug + when /^api\/index/ + 'API' + when /^api/ + get_name + else + 'Guides' + end + end + end + end +end diff --git a/lib/docs/filters/leaflet/clean_html.rb b/lib/docs/filters/leaflet/clean_html.rb new file mode 100644 index 00000000..802463de --- /dev/null +++ b/lib/docs/filters/leaflet/clean_html.rb @@ -0,0 +1,40 @@ +module Docs + class Leaflet + class CleanHtmlFilter < Filter + def call + css('#toc', '.expander', '.footer').remove + + css('h1').each do |node| + node.name = 'h2' + end + + at_css('> h2:first-child').name = 'h1' + + # remove "This reference reflects Leaflet 1.2.0." + css('h1 ~ p').each do |node| + node.remove + break + end + + css('section', 'code b', '.accordion', '.accordion-overflow', '.accordion-content').each do |node| + node.before(node.children).remove + end + + css('pre > code').each do |node| + node['class'] ||= '' + lang = if node['class'].include?('lang-html') || node.content =~ /\A + 'html' + elsif node['class'].include?('lang-css') + 'css' + elsif node['class'].include?('lang-js') || node['class'].include?('lang-javascript') + 'javascript' + end + node.parent['data-language'] = lang if lang + node.before(node.children).remove + end + + doc + end + end + end +end diff --git a/lib/docs/filters/leaflet/entries.rb b/lib/docs/filters/leaflet/entries.rb new file mode 100644 index 00000000..c246d5ad --- /dev/null +++ b/lib/docs/filters/leaflet/entries.rb @@ -0,0 +1,33 @@ +module Docs + class Leaflet + class EntriesFilter < Docs::EntriesFilter + def additional_entries + entries = [] + type = nil + subtype = nil + + css('*').each do |node| + if node.name == 'h2' && node['id'] + type = node.content + subtype = nil + entries << [type, node['id'], type] + elsif node.name == 'h3' + subtype = node.content + elsif node.name == 'tr' && node['id'] + value = node.css('td > code > b').first.content + if subtype && subtype.end_with?(' options') + name = "#{subtype}: #{value}" + elsif subtype + name = "#{type} #{subtype.downcase}: #{value}" + else + name = "#{type}: #{value}" + end + entries << [name, node['id'], type] + end + end + + entries + end + end + end +end diff --git a/lib/docs/filters/react_native/entries.rb b/lib/docs/filters/react_native/entries.rb index 54583368..71a55ece 100644 --- a/lib/docs/filters/react_native/entries.rb +++ b/lib/docs/filters/react_native/entries.rb @@ -12,7 +12,7 @@ module Docs end def get_type - link = at_css('.navItemActive') + link = at_css('.navListItemActive') return 'Miscellaneous' unless link section = link.ancestors('.navGroup').first type = section.at_css('h3').content.strip diff --git a/lib/docs/filters/svg/entries.rb b/lib/docs/filters/svg/entries.rb index aebdeb76..b1fbfe9c 100644 --- a/lib/docs/filters/svg/entries.rb +++ b/lib/docs/filters/svg/entries.rb @@ -3,8 +3,8 @@ module Docs class EntriesFilter < Docs::EntriesFilter def get_name name = super - name.gsub!('Element.', '').try(:downcase!) - name.gsub!('Attribute.', '').try(:downcase!) + name.gsub!('Element.', '') + name.gsub!('Attribute.', '') name.gsub!('Tutorial.', '') name.gsub!('_', '') diff --git a/lib/docs/filters/terraform/clean_html.rb b/lib/docs/filters/terraform/clean_html.rb new file mode 100644 index 00000000..7d662293 --- /dev/null +++ b/lib/docs/filters/terraform/clean_html.rb @@ -0,0 +1,33 @@ +module Docs + class Terraform + class CleanHtmlFilter < Filter + def call + @doc = at_css('#inner') + + css('hr', 'a.anchor').remove + + css('.alert').each do |node| + node.name = 'blockquote' + end + + css('pre').each do |node| + if language = node['class'][/(json|shell|ruby)/, 1] + node['data-language'] = language + end + # HCL isn't currently supported by Prism, Ruby syntax does an acceptable job for now + if language = node['class'][/(hcl)/, 1] + node['data-language'] = 'ruby' + end + node.content = node.content + node.remove_attribute('class') + end + + css('.highlight').each do |node| + node.before(node.children).remove + end + + doc + end + end + end +end diff --git a/lib/docs/filters/terraform/entries.rb b/lib/docs/filters/terraform/entries.rb new file mode 100644 index 00000000..486edac9 --- /dev/null +++ b/lib/docs/filters/terraform/entries.rb @@ -0,0 +1,76 @@ +module Docs + class Terraform + class EntriesFilter < Docs::EntriesFilter + + # Some providers have non-trivial mappings between the directory they live in and their name + # Anything *not* in this list will be capitalized instead. + PROVIDER_NAME_MAP = { + 'aws' => 'AWS', + 'azure' => 'Azure (Legacy)', + 'azurerm' => 'Azure', + 'centurylinkcloud' => 'CenturyLinkCloud', + 'cloudscale' => 'CloudScale.ch', + 'cloudstack' => 'CloudStack', + 'dme' => 'DNSMadeEasy', + 'dns' => 'DNS', + 'dnsimple' => 'DNSimple', + 'do' => 'DigitalOcean', + 'github' => 'GitHub', + 'google' => 'Google Cloud', + 'http' => 'HTTP', + 'mysql' => 'MySQL', + 'newrelic' => 'New Relic', + 'oneandone' => '1&1', + 'opentelekomcloud' => 'OpenTelekomCloud', + 'opsgenie' => 'OpsGenie', + 'opc' => 'Oracle Public Cloud', + 'oraclepaas' => 'Oracle Cloud Platform', + 'ovh' => 'OVH', + 'pagerduty' => 'PagerDuty', + 'panos' => 'Palo Alto Networks', + 'postgresql' => 'PostgreSQL', + 'powerdns' => 'PowerDNS', + 'profitbricks' => 'ProfitBricks', + 'rabbitmq' => 'RabbitMQ', + 'softlayer' => 'SoftLayer', + 'statuscake' => 'StatusCake', + 'tls' => 'TLS', + 'ultradns' => 'UltraDNS', + 'vcd' => 'VMware vCloud Director', + 'nsxt' => 'VMware NSX-T', + 'vsphere' => 'VMware vSphere', + } + + # Some providers have a lot (> 100) entries, which makes browsing them unwieldy. + # Any present in the list below will have an extra set of types added, breaking the pages out into the different + # products they offer. + LARGE_PROVIDERS = { + "aws" => true, + "azurerm" => true, + "google" => true, + } + + + def get_name + name ||= at_css('#inner h1').content + name.remove! "ยป " + name.remove! "Data Source: " + name + end + + def get_type + category, subcategory, subfolder, page = *slug.split('/') + provider = page ? subcategory : category + nice_provider = PROVIDER_NAME_MAP[provider] || provider.capitalize + + if LARGE_PROVIDERS[provider] + category_node = at_css('ul > li > ul > li.active') + parent_node = category_node.parent.previous_element if category_node + nice_provider = nice_provider + ": #{parent_node.content}" if category_node + end + + nice_provider + end + end + end +end diff --git a/lib/docs/scrapers/ansible.rb b/lib/docs/scrapers/ansible.rb index 2ac3ee6f..6292b83c 100644 --- a/lib/docs/scrapers/ansible.rb +++ b/lib/docs/scrapers/ansible.rb @@ -15,6 +15,26 @@ module Docs Licensed under the GNU General Public License version 3. HTML + version '2.6' do + self.release = '2.6.1' + self.base_url = 'https://docs.ansible.com/ansible/2.6/' + + options[:skip] = %w( + installation_guide/index.html + reference_appendices/glossary.html + reference_appendices/faq.html + reference_appendices/tower.html + user_guide/quickstart.html + modules/modules_by_category.html + modules/list_of_all_modules.html) + + options[:skip_patterns] = [ + /\Acommunity.*/i, + /\Adev_guide.*/i, + /\Aroadmap.*/i, + ] + end + version '2.5' do self.release = '2.5.3' self.base_url = 'https://docs.ansible.com/ansible/2.5/' diff --git a/lib/docs/scrapers/codeceptjs.rb b/lib/docs/scrapers/codeceptjs.rb index c30a4a59..6fd2798c 100644 --- a/lib/docs/scrapers/codeceptjs.rb +++ b/lib/docs/scrapers/codeceptjs.rb @@ -3,7 +3,7 @@ module Docs self.name = 'CodeceptJS' self.type = 'codeceptjs' self.root_path = 'index.html' - self.release = '1.2.1' + self.release = '1.3.1' self.base_url = 'https://codecept.io/' self.links = { home: 'https://codecept.io/', diff --git a/lib/docs/scrapers/crystal.rb b/lib/docs/scrapers/crystal.rb index 1e95e540..bf8e8392 100644 --- a/lib/docs/scrapers/crystal.rb +++ b/lib/docs/scrapers/crystal.rb @@ -1,7 +1,7 @@ module Docs class Crystal < UrlScraper self.type = 'crystal' - self.release = '0.24.1' + self.release = '0.25.1' self.base_url = 'https://crystal-lang.org/' self.root_path = "api/#{release}/index.html" self.initial_paths = %w(docs/index.html) @@ -29,7 +29,7 @@ module Docs HTML else <<-HTML - © 2012–2017 Manas Technology Solutions.