* master: (27 commits) Update MDN docs Finish Koa scraper Add Koa Finish Terraform scraper Add a Terraform scraper Update Ansible documentation (2.6.1) Finish Leaflet scraper Update link to freecodecamp blog Add leaflet doc Update CodeceptJS documentation (1.3.1) Update Electron documentation (2.0.2) Update Django documentation (2.0.7) Update Erlang documentation (21.0) Update D documentation (2.081.0) Update ReactNative documentation (0.56) Update Node.js documentation (10.6.0) Update Sinon.JS documentation (6.1.3) Update Python documentation (3.7.0) Fix header alignment in Python (issue #808) update Flow version ...pull/821/merge
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 42 KiB |
@ -0,0 +1,6 @@
|
||||
._python {
|
||||
@extend %sphinx;
|
||||
|
||||
h2 > a, h3 > a, dt[id] > a.external, dt[id] > a.internal { float: none !important; }
|
||||
}
|
||||
|
@ -0,0 +1,4 @@
|
||||
._terraform {
|
||||
@extend %simple;
|
||||
.note, .alert { @extend %note; }
|
||||
}
|
@ -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
|
||||
<h1>Koa</h1>
|
||||
<!-- https://github.com/koajs/koa/blob/841844e/Readme.md -->
|
||||
<h2 id="introduction">Introduction</h2>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
<p>
|
||||
Koa is not bundled with any middleware.
|
||||
</p>
|
||||
HTML
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -0,0 +1,38 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Docs
|
||||
class Koa < Github
|
||||
self.base_url = 'https://github.com/koajs/koa/blob/master/docs/'
|
||||
self.release = '2.5.1'
|
||||
|
||||
self.root_path = 'api/index.md'
|
||||
self.initial_paths = %w[
|
||||
error-handling
|
||||
faq
|
||||
guide
|
||||
koa-vs-express
|
||||
migration
|
||||
troubleshooting
|
||||
api/index
|
||||
api/context
|
||||
api/request
|
||||
api/response
|
||||
].map { |name| name + '.md' }
|
||||
|
||||
self.links = {
|
||||
home: 'https://koajs.com/',
|
||||
code: 'https://github.com/koajs/koa'
|
||||
}
|
||||
|
||||
html_filters.push 'koa/clean_html', 'koa/entries'
|
||||
|
||||
options[:skip] = %w[middleware.gif]
|
||||
options[:trailing_slash] = false
|
||||
options[:container] = '.markdown-body'
|
||||
|
||||
options[:attribution] = <<-HTML
|
||||
© 2018 Koa contributors<br>
|
||||
Licensed under the MIT License.
|
||||
HTML
|
||||
end
|
||||
end
|
@ -0,0 +1,43 @@
|
||||
module Docs
|
||||
class Leaflet < UrlScraper
|
||||
self.name = 'Leaflet'
|
||||
self.type = 'simple'
|
||||
self.slug = 'leaflet'
|
||||
self.links = {
|
||||
home: 'https://leafletjs.com/',
|
||||
code: 'https://github.com/Leaflet/Leaflet'
|
||||
}
|
||||
|
||||
html_filters.push 'leaflet/entries', 'leaflet/clean_html', 'title'
|
||||
|
||||
options[:container] = '.container'
|
||||
options[:skip_links] = true
|
||||
|
||||
options[:attribution] = <<-HTML
|
||||
© 2010–2018 Vladimir Agafonkin<br>
|
||||
© 2010–2011, CloudMade<br>
|
||||
Maps © OpenStreetMap contributors.
|
||||
HTML
|
||||
|
||||
version '1.3' do
|
||||
self.release = '1.3.0'
|
||||
self.base_url = "https://leafletjs.com/reference-#{release}.html"
|
||||
end
|
||||
|
||||
version '1.2' do
|
||||
self.release = '1.2.0'
|
||||
self.base_url = "https://leafletjs.com/reference-#{release}.html"
|
||||
end
|
||||
|
||||
version '1.1' do
|
||||
self.release = '1.1.0'
|
||||
self.base_url = "https://leafletjs.com/reference-#{release}.html"
|
||||
end
|
||||
|
||||
version '1.0' do
|
||||
self.release = '1.0.3'
|
||||
self.base_url = "https://leafletjs.com/reference-#{release}.html"
|
||||
end
|
||||
|
||||
end
|
||||
end
|
@ -0,0 +1,22 @@
|
||||
module Docs
|
||||
class Terraform < UrlScraper
|
||||
self.name = 'Terraform'
|
||||
self.type = 'terraform'
|
||||
self.release = '0.11.7'
|
||||
self.base_url = 'https://www.terraform.io/docs/'
|
||||
self.root_path = 'index.html'
|
||||
self.links = {
|
||||
home: 'https://www.terraform.io/',
|
||||
code: 'https://github.com/hashicorp/terraform'
|
||||
}
|
||||
|
||||
html_filters.push 'terraform/entries', 'terraform/clean_html'
|
||||
|
||||
options[:skip_patterns] = [/enterprise/, /enterprise-legacy/]
|
||||
|
||||
options[:attribution] = <<-HTML
|
||||
© 2018 HashiCorp</br>
|
||||
Licensed under the MPL 2.0 License.
|
||||
HTML
|
||||
end
|
||||
end
|
After Width: | Height: | Size: 670 B |
After Width: | Height: | Size: 1.6 KiB |
@ -0,0 +1 @@
|
||||
http://leafletjs.com/docs/images/favicon.ico
|
After Width: | Height: | Size: 356 B |
After Width: | Height: | Size: 577 B |