Przeglądaj źródła

Merge branch 'master' into typo-fixes

Jasper van Merle 6 lat temu
rodzic
commit
971d2c67dd

+ 1 - 1
Dockerfile

@@ -6,7 +6,7 @@ ENV ENABLE_SERVICE_WORKER=true
 WORKDIR /devdocs
 
 RUN apt-get update && \
-    apt-get -y install git nodejs && \
+    apt-get -y install git nodejs libcurl4 && \
     gem install bundler && \
     rm -rf /var/lib/apt/lists/*
 

+ 1 - 1
Dockerfile-alpine

@@ -7,7 +7,7 @@ WORKDIR /devdocs
 
 COPY . /devdocs
 
-RUN apk --update add nodejs build-base libstdc++ gzip git zlib-dev && \
+RUN apk --update add nodejs build-base libstdc++ gzip git zlib-dev libcurl && \
     gem install bundler && \
     bundle install --system --without test && \
     thor docs:download --all && \

+ 1 - 1
assets/javascripts/app/app.coffee

@@ -78,7 +78,7 @@
         .install()
       @previousErrorHandler = onerror
       window.onerror = @onWindowError.bind(@)
-      CookieStore.onBlocked = @onCookieBlocked
+      CookiesStore.onBlocked = @onCookieBlocked
     return
 
   bootOne: ->

+ 1 - 0
assets/javascripts/app/config.coffee.erb

@@ -13,5 +13,6 @@ app.config =
   version: <%= Time.now.to_i %>
   release: <%= Time.now.utc.httpdate.to_json %>
   mathml_stylesheet: '<%= App.cdn_origin %>/mathml.css'
+  favicon_spritesheet: '<%= image_path('sprites/docs.png') %>'
   service_worker_path: '/service-worker.js'
   service_worker_enabled: <%= App.environment == :production || ENV['ENABLE_SERVICE_WORKER'] == 'true' %>

+ 1 - 1
assets/javascripts/app/settings.coffee

@@ -33,7 +33,7 @@ class app.Settings
     analyticsConsent: false
 
   constructor: ->
-    @store = new CookieStore
+    @store = new CookiesStore
     @cache = {}
 
   get: (key) ->

+ 5 - 1
assets/javascripts/lib/cookie_store.coffee → assets/javascripts/lib/cookies_store.coffee

@@ -1,4 +1,8 @@
-class @CookieStore
+class @CookiesStore
+  # Intentionally called CookiesStore instead of CookieStore
+  # Calling it CookieStore causes issues when the Experimental Web Platform features flag is enabled in Chrome
+  # Related issue: https://github.com/freeCodeCamp/devdocs/issues/932
+
   INT = /^\d+$/
 
   @onBlocked: ->

+ 64 - 0
assets/javascripts/lib/favicon.coffee

@@ -0,0 +1,64 @@
+defaultUrl = null
+currentSlug = null
+
+imageCache = {}
+urlCache = {}
+
+withImage = (url, action) ->
+  if imageCache[url]
+    action(imageCache[url])
+  else
+    img = new Image()
+    img.crossOrigin = 'anonymous'
+    img.src = url
+    img.onload = () =>
+      imageCache[url] = img
+      action(img)
+
+@setFaviconForDoc = (doc) ->
+  return if currentSlug == doc.slug
+
+  favicon = $('link[rel="icon"]')
+
+  if defaultUrl == null
+    defaultUrl = favicon.href
+
+  if urlCache[doc.slug]
+    favicon.href = urlCache[doc.slug]
+    currentSlug = doc.slug
+    return
+
+  styles = window.getComputedStyle($("._icon-#{doc.slug.split('~')[0]}"), ':before')
+
+  bgUrl = app.config.favicon_spritesheet
+  sourceSize = 16
+  sourceX = Math.abs(parseInt(styles['background-position-x'].slice(0, -2)))
+  sourceY = Math.abs(parseInt(styles['background-position-y'].slice(0, -2)))
+
+  withImage(bgUrl, (docImg) ->
+    withImage(defaultUrl, (defaultImg) ->
+      size = defaultImg.width
+
+      canvas = document.createElement('canvas')
+      ctx = canvas.getContext('2d')
+
+      canvas.width = size
+      canvas.height = size
+      ctx.drawImage(defaultImg, 0, 0)
+
+      docIconPercentage = 65
+      destinationCoords = size / 100 * (100 - docIconPercentage)
+      destinationSize = size / 100 * docIconPercentage
+      ctx.drawImage(docImg, sourceX, sourceY, sourceSize, sourceSize, destinationCoords, destinationCoords, destinationSize, destinationSize)
+
+      urlCache[doc.slug] = canvas.toDataURL()
+      favicon.href = urlCache[doc.slug]
+
+      currentSlug = doc.slug
+    )
+  )
+
+@resetFavicon = () ->
+  if defaultUrl != null and currentSlug != null
+    $('link[rel="icon"]').href = defaultUrl
+    currentSlug = null

+ 3 - 0
assets/javascripts/views/content/content.coffee

@@ -153,6 +153,9 @@ class app.views.Content extends app.View
     return
 
   afterRoute: (route, context) =>
+    if route != 'entry' and route != 'type'
+      resetFavicon()
+
     switch route
       when 'root'
         @show @rootPage

+ 1 - 0
assets/javascripts/views/content/entry_page.coffee

@@ -40,6 +40,7 @@ class app.views.EntryPage extends app.View
     if app.disabledDocs.findBy 'slug', @entry.doc.slug
       @hiddenView = new app.views.HiddenPage @el, @entry
 
+    setFaviconForDoc(@entry.doc)
     @delay @polyfillMathML
     @trigger 'loaded'
     return

+ 1 - 0
assets/javascripts/views/content/type_page.coffee

@@ -9,6 +9,7 @@ class app.views.TypePage extends app.View
 
   render: (@type) ->
     @html @tmpl('typePage', @type)
+    setFaviconForDoc(@type.doc)
     return
 
   getTitle: ->

+ 5 - 0
lib/docs/filters/elixir/clean_html.rb

@@ -57,6 +57,11 @@ module Docs
           node.parent.after(node)
         end
 
+        css('.signature').each do |node|
+          non_text_children = node.xpath('node()[not(self::text())]')
+          non_text_children.to_a.reverse.each { |child| node.parent.add_next_sibling(child) }
+        end
+
         css('pre').each do |node|
           node['data-language'] = 'elixir'
           node.content = node.content

+ 5 - 0
lib/docs/filters/homebrew/clean_html.rb

@@ -4,6 +4,11 @@ module Docs
       def call
         css('hr')
 
+        if at_css('h1').nil?
+          title = current_url.normalized_path[1..-1].gsub(/-/, ' ')
+          doc.children.before("<h1>#{title}</h1>")
+        end
+
         css('div.highlighter-rouge').each do |node|
           lang = node['class'][/language-(\w+)/, 1]
           node['data-language'] = lang if lang

+ 3 - 1
lib/docs/filters/homebrew/entries.rb

@@ -2,7 +2,8 @@ module Docs
   class Homebrew
     class EntriesFilter < Docs::EntriesFilter
       def get_name
-        name = at_css('h1').content.strip
+        header = at_css('h1')
+        name = header.nil? ? current_url.normalized_path[1..-1].gsub(/-/, ' ') : header.content.strip
         name.remove! %r{\(.*}
         name
       end
@@ -16,6 +17,7 @@ module Docs
         Python-for-Formula-Authors
         Migrating-A-Formula-To-A-Tap
         Rename-A-Formula
+        Building-Against-Non-Homebrew-Dependencies
         How-to-Create-and-Maintain-a-Tap
         Brew-Test-Bot
         Prose-Style-Guidelines)

+ 7 - 0
lib/docs/filters/kotlin/clean_html.rb

@@ -46,6 +46,13 @@ module Docs
           parent.content = parent.content
           parent['data-language'] = 'kotlin'
         end
+
+        css('.tags').each do |wrapper|
+          platforms = wrapper.css('.platform:not(.tag-value-Common)').to_a
+          platforms = platforms.map { |node| "#{node.content} (#{node['data-tag-version']})" }
+          platforms = "<b>Platform and version requirements:</b> #{platforms.join ", "}"
+          wrapper.replace(platforms)
+        end
       end
     end
   end

+ 3 - 1
lib/docs/filters/kotlin/entries.rb

@@ -5,7 +5,9 @@ module Docs
         if subpath.start_with?('api')
           breadcrumbs[1..-1].join('.')
         else
-          (at_css('h1') || at_css('h2')).content
+          node = (at_css('h1') || at_css('h2'))
+          return node.content unless node.nil?
+          subpath[/\/([a-z0-9_-]+)\./][1..-2].titleize.sub('Faq', 'FAQ')
         end
       end
 

+ 5 - 3
lib/docs/filters/pandas/entries.rb

@@ -2,8 +2,10 @@ module Docs
   class Pandas
     class EntriesFilter < Docs::EntriesFilter
       def get_name
-        if subpath.start_with?('generated')
-          name = at_css('dt').content.strip
+        if subpath.start_with?('generated') || (subpath.include?('reference') && !subpath.include?('reference/index'))
+          name_node = at_css('dt')
+          name_node = at_css('h1') if name_node.nil?
+          name = name_node.content.strip
           name.sub! %r{\(.*}, '()'
           name.remove! %r{\s=.*}
           name.remove! %r{\A(class(method)?) (pandas\.)?}
@@ -16,7 +18,7 @@ module Docs
       end
 
       def get_type
-        if subpath.start_with?('generated')
+        if subpath.start_with?('generated') || (subpath.include?('reference') && !subpath.include?('reference/index'))
           css('.toctree-l2.current > a').last.content.remove(/\s\(.+?\)/)
         else
           'Manual'

+ 1 - 0
lib/docs/filters/qt/clean_html.rb

@@ -8,6 +8,7 @@ module Docs
         # QML property/method header
         css('.qmlproto').each do |node|
           id = node.at_css('tr')['id']
+          id = node.at_css('a')['name'] if id.blank?
           node.inner_html = node.at_css('td').inner_html
           node.name = 'h3'
           node['id'] = id

+ 1 - 0
lib/docs/filters/qt/entries.rb

@@ -111,6 +111,7 @@ module Docs
         css('.qmlproto').each do |node|
           title = node.content.strip
           id = node.at_css('tr')['id']
+          id = node.at_css('a')['name'] if id.blank?
 
           # Remove options
           title.remove!(%r{^\[.*\] })

+ 9 - 4
lib/docs/scrapers/clojure.rb

@@ -13,18 +13,23 @@ module Docs
       Licensed under the Eclipse Public License 1.0.
     HTML
 
-    version '1.9' do
-      self.release = '1.9'
+    version '1.10' do
+      self.release = '1.10 (stable)'
       self.base_url = 'https://clojure.github.io/clojure/'
     end
 
+    version '1.9' do
+      self.release = '1.9 (legacy)'
+      self.base_url = 'https://clojure.github.io/clojure/branch-clojure-1.9.0/'
+    end
+
     version '1.8' do
-      self.release = '1.8'
+      self.release = '1.8 (legacy)'
       self.base_url = 'https://clojure.github.io/clojure/branch-clojure-1.8.0/'
     end
 
     version '1.7' do
-      self.release = '1.7'
+      self.release = '1.7 (legacy)'
       self.base_url = 'https://clojure.github.io/clojure/branch-clojure-1.7.0/'
     end
 

+ 8 - 3
lib/docs/scrapers/django.rb

@@ -34,18 +34,23 @@ module Docs
       Licensed under the BSD License.
     HTML
 
+    version '2.2' do
+      self.release = '2.2.4'
+      self.base_url = 'https://docs.djangoproject.com/en/2.2/'
+    end
+
     version '2.1' do
-      self.release = '2.1.0'
+      self.release = '2.1.11'
       self.base_url = 'https://docs.djangoproject.com/en/2.1/'
     end
 
     version '2.0' do
-      self.release = '2.0.7'
+      self.release = '2.0.13'
       self.base_url = 'https://docs.djangoproject.com/en/2.0/'
     end
 
     version '1.11' do
-      self.release = '1.11.9'
+      self.release = '1.11.23'
       self.base_url = 'https://docs.djangoproject.com/en/1.11/'
     end
 

+ 147 - 26
lib/docs/scrapers/docker.rb

@@ -15,15 +15,69 @@ module Docs
     end
 
     options[:attribution] = <<-HTML
-      &copy; 2017 Docker, Inc.<br>
+      &copy; 2019 Docker, Inc.<br>
       Licensed under the Apache License, Version 2.0.<br>
       Docker and the Docker logo are trademarks or registered trademarks of Docker, Inc. in the United States and/or other countries.<br>
       Docker, Inc. and other parties may also have trademark rights in other terms used herein.
     HTML
 
-    version '17' do
-      self.release = '17.06'
-      self.base_url = 'https://docs.docker.com/'
+    version '19' do
+      self.release = '19.03'
+      self.base_url = "https://docs.docker.com/"
+
+      html_filters.push 'docker/entries', 'docker/clean_html'
+
+      options[:container] = '.wrapper .container-fluid .row'
+
+      options[:only_patterns] = [/\Aget-started\//, /\Aengine\//, /\Acompose\//, /\Amachine\//, /\Anotary\//]
+      options[:skip_patterns] = [/\Aengine\/api\/v/, /glossary/, /docker-ee/]
+
+      options[:replace_paths] = {
+        'install/linux/ubuntu/' => 'install/linux/docker-ce',
+        'get-started/part1' => 'get-started',
+        'engine/installation/' => 'install',
+        'engine/installation/linux/linux-postinstall/' => 'install/linux',
+        'compose/overview/' => 'compose',
+        'docker-cloud/' => 'docker-hub',
+        'datacenter/install/linux/' => 'ee',
+        'engine/userguide/' => 'config/daemon',
+        'engine/admin/' => 'config/daemon',
+        'opensource/get-help/' => 'opensource',
+        'engine/tutorials/dockerimages/' => 'get-started',
+        'engine/admin/volumes/bind-mounts/' => 'storage',
+        'engine/tutorials/dockervolumes/' => 'storage',
+        'engine/admin/volumes/volumes/' => 'storage',
+        'engine/userguide/labels-custom-metadata/' => 'config',
+        'engine/userguide/eng-image/multistage-build/' => 'develop/develop-images',
+        'engine/swarm/networking/' => 'network',
+        'engine/admin/resource_constraints/' => 'config/containers',
+        'engine/admin/logging/overview/' => 'config/containers/logging',
+        'engine/userguide/eng-image/dockerfile_best-practices/' => 'develop/develop-images',
+        'engine/tutorials/dockerrepos/' => 'get-started',
+        'engine/userguide/networking/' => 'network',
+        'engine/userguide/networking/get-started-overlay/' => 'network',
+        'engine/reference/commandline/swarm_join_token/' => 'engine/reference/commandline',
+        'engine/understanding-docker/' => 'engine',
+        'engine/userguide/dockervolumes/' => 'storage',
+        'engine/installation/binaries/' => 'install/linux/docker-ce',
+        'engine/userguide/networking/default_network/dockerlinks/' => 'network',
+        'engine/reference/api/' => 'develop/sdk',
+        'engine/admin/systemd/' => 'config/daemon',
+        'engine/userguide/storagedriver/imagesandcontainers/' => 'storage/storagedriver',
+        'engine/api/' => 'develop/sdk',
+        'engine/userguide/networking/get-started-overlay' => 'network',
+        'engine/userguide/networking/overlay-security-model/' => 'network',
+        'engine/installation/linux/docker-ce/binaries/' => 'install/linux/docker-ce',
+        'engine/admin/volumes/' => 'storage/volumes/',
+        'engine/userguide/networking//' => 'network',
+        'engine/reference/commandline' => 'engine/reference/commandline/docker',
+        'engine/reference/commandline/' => 'engine/reference/commandline/docker/',
+      }
+    end
+
+    version '18' do
+      self.release = '18.09'
+      self.base_url = "https://docs.docker.com/v#{release}/"
 
       html_filters.push 'docker/entries', 'docker/clean_html'
 
@@ -33,29 +87,96 @@ module Docs
       options[:skip_patterns] = [/\Aengine\/api\/v/, /glossary/, /docker-ee/]
 
       options[:replace_paths] = {
-        'engine/installation/linux/docker-ee/linux-postinstall/' => 'engine/installation/linux/linux-postinstall/',
-        'engine/installation/linux/docker-ee/' => 'engine/installation/',
-        'engine/installation/linux/docker-ce/' => 'engine/installation/',
-        'engine/installation/linux/' => 'engine/installation/',
-        'engine/installation/windows/' => 'engine/installation/',
-        'engine/userguide/intro/' => 'engine/userguide/',
-        'engine/tutorials/dockervolumes/' => 'engine/admin/volumes/volumes/',
-        'engine/getstarted/' => 'get-started/',
-        'engine/tutorials/dockerimages/' => 'get-started/',
-        'engine/tutorials/dockerrepos/' => 'get-started/',
-        'engine/admin/host_integration/' => 'engine/admin/start-containers-automatically/',
-        'engine/installation/linux/rhel/' => 'engine/installation/linux/docker-ee/rhel/',
-        'engine/installation/linux/ubuntulinux/' => 'engine/installation/linux/docker-ee/ubuntu/',
-        'engine/installation/linux/suse/' => 'engine/installation/linux/docker-ee/suse/',
-        'engine/admin/logging/' => 'engine/admin/logging/view_container_logs/',
-        'engine/swarm/how-swarm-mode-works/' => 'engine/swarm/how-swarm-mode-works/nodes/',
-        'engine/installation/binaries/' => 'engine/installation/linux/docker-ce/binaries/',
+        'install/linux/ubuntu/' => 'install/linux/docker-ce',
+        'get-started/part1' => 'get-started',
+        'engine/installation/' => 'install',
+        'engine/installation/linux/linux-postinstall/' => 'install/linux',
+        'compose/overview/' => 'compose',
+        'datacenter/install/linux/' => 'ee',
+        'engine/userguide/' => 'config/daemon',
+        'engine/admin/' => 'config/daemon',
+        'opensource/get-help/' => 'opensource',
+        'engine/tutorials/dockerimages/' => 'get-started',
+        'engine/admin/volumes/bind-mounts/' => 'storage',
+        'engine/tutorials/dockervolumes/' => 'storage',
+        'engine/admin/volumes/volumes/' => 'storage',
+        'engine/userguide/labels-custom-metadata/' => 'config',
+        'engine/reference/api/' => 'develop/sdk',
+        'engine/userguide/eng-image/multistage-build/' => 'develop/develop-images',
+        'engine/swarm/networking/' => 'network',
+        'engine/admin/resource_constraints/' => 'config/containers',
+        'engine/admin/logging/overview/' => 'config/containers/logging',
+        'engine/userguide/eng-image/dockerfile_best-practices/' => 'develop/develop-images',
+        'engine/tutorials/dockerrepos/' => 'get-started',
+        'engine/userguide/networking/' => 'network',
+        'engine/userguide/networking/get-started-overlay/' => 'network',
+        'engine/understanding-docker/' => 'engine',
+        'engine/reference/commandline/swarm_join_token/' => 'engine/reference/commandline',
+        'engine/userguide/dockervolumes/' => 'storage',
+        'engine/admin/systemd/' => 'config/daemon',
+        'engine/userguide/storagedriver/imagesandcontainers/' => 'storage/storagedriver',
+        'engine/installation/binaries/' => 'install/linux/docker-ce',
+        'engine/userguide/networking/default_network/dockerlinks/' => 'network',
+        'engine/userguide/networking/overlay-security-model/' => 'network',
+        'engine/userguide/networking/get-started-overlay' => 'network',
+        'engine/api/' => 'develop/sdk',
+        'engine/installation/linux/docker-ce/binaries/' => 'install/linux/docker-ce',
+        'engine/admin/volumes/' => 'storage/volumes/',
+        'engine/userguide/networking//' => 'network',
+        'engine/reference/commandline' => 'engine/reference/commandline/docker',
         'engine/reference/commandline/' => 'engine/reference/commandline/docker/',
-        'engine/reference/api/' => 'engine/api/',
-        'engine/userguide/dockervolumes/' => 'engine/admin/volumes/volumes/',
-        'engine/understanding-docker/' => 'engine/docker-overview/',
-        'engine/reference/commandline/swarm_join_token/' => 'engine/reference/commandline/swarm_join-token/',
-        'engine/api/getting-started/' => 'engine/api/get-started/',
+      }
+    end
+
+    version '17' do
+      self.release = '17.12'
+      self.base_url = "https://docs.docker.com/v#{release}/"
+
+      html_filters.push 'docker/entries', 'docker/clean_html'
+
+      options[:container] = '.wrapper .container-fluid .row'
+
+      options[:only_patterns] = [/\Aget-started\//, /\Aengine\//, /\Acompose\//, /\Amachine\//, /\Anotary\//]
+      options[:skip_patterns] = [/\Aengine\/api\/v/, /glossary/, /docker-ee/]
+
+      options[:replace_paths] = {
+        'get-started/part1' => 'get-started',
+        'engine/installation/' => 'install',
+        'engine/installation/linux/linux-postinstall/' => 'install/linux',
+        'opensource/get-help/' => 'opensource',
+        'engine/admin/volumes/volumes/' => 'storage',
+        'engine/tutorials/dockerimages/' => 'get-started',
+        'engine/admin/volumes/bind-mounts/' => 'storage',
+        'engine/tutorials/dockervolumes/' => 'storage',
+        'datacenter/install/aws/' => 'docker-for-aws',
+        'engine/userguide/' => 'config/daemon',
+        'engine/admin/' => 'config/daemon',
+        'engine/userguide/labels-custom-metadata/' => 'config',
+        'engine/userguide/eng-image/multistage-build/' => 'develop/develop-images',
+        'engine/swarm/networking/' => 'network',
+        'engine/admin/resource_constraints/' => 'config/containers',
+        'engine/admin/logging/overview/' => 'config/containers/logging',
+        'engine/understanding-docker/' => 'engine',
+        'engine/userguide/eng-image/dockerfile_best-practices/' => 'develop/develop-images',
+        'engine/tutorials/dockerrepos/' => 'get-started',
+        'engine/userguide/networking/' => 'network',
+        'engine/reference/commandline/swarm_join_token/' => 'edge/engine/reference/commandline',
+        'engine/userguide/networking/get-started-overlay/' => 'network',
+        'engine/userguide/dockervolumes/' => 'storage',
+        'engine/installation/binaries/' => 'install/linux/docker-ce',
+        'engine/userguide/networking/default_network/dockerlinks/' => 'network',
+        'engine/reference/api/' => 'develop/sdk',
+        'engine/admin/live-restore/' => 'config/containers',
+        'engine/api/' => 'develop/sdk',
+        'engine/userguide/networking/get-started-overlay' => 'network',
+        'security/security/' => 'engine/security',
+        'engine/installation/linux/docker-ce/binaries/' => 'install/linux/docker-ce',
+        'engine/reference/commandline/' => 'edge/engine/reference/commandline',
+        'engine/admin/systemd/' => 'config/daemon',
+        'engine/userguide/storagedriver/imagesandcontainers/' => 'storage/storagedriver',
+        'engine/userguide/networking/overlay-security-model/' => 'network',
+        'engine/admin/volumes/' => 'storage/volumes/',
+        'engine/userguide/networking//' => 'network',
       }
     end
 

+ 28 - 2
lib/docs/scrapers/elixir.rb

@@ -33,8 +33,34 @@ module Docs
         "https://elixir-lang.org/getting-started/introduction.html" ]
     end
 
+    version '1.9' do
+      self.release = '1.9.1'
+      self.base_urls = [
+        "https://hexdocs.pm/elixir/#{release}/",
+        "https://hexdocs.pm/eex/#{release}/",
+        "https://hexdocs.pm/ex_unit/#{release}/",
+        "https://hexdocs.pm/iex/#{release}/",
+        "https://hexdocs.pm/logger/#{release}/",
+        "https://hexdocs.pm/mix/#{release}/",
+        'https://elixir-lang.org/getting-started/'
+      ]
+    end
+
+    version '1.8' do
+      self.release = '1.8.2'
+      self.base_urls = [
+        "https://hexdocs.pm/elixir/#{release}/",
+        "https://hexdocs.pm/eex/#{release}/",
+        "https://hexdocs.pm/ex_unit/#{release}/",
+        "https://hexdocs.pm/iex/#{release}/",
+        "https://hexdocs.pm/logger/#{release}/",
+        "https://hexdocs.pm/mix/#{release}/",
+        'https://elixir-lang.org/getting-started/'
+      ]
+    end
+
     version '1.7' do
-      self.release = '1.7.3'
+      self.release = '1.7.4'
       self.base_urls = [
         "https://hexdocs.pm/elixir/#{release}/",
         "https://hexdocs.pm/eex/#{release}/",
@@ -47,7 +73,7 @@ module Docs
     end
 
     version '1.6' do
-      self.release = '1.6.5'
+      self.release = '1.6.6'
       self.base_urls = [
         "https://hexdocs.pm/elixir/#{release}/",
         "https://hexdocs.pm/eex/#{release}/",

+ 1 - 1
lib/docs/scrapers/homebrew.rb

@@ -2,7 +2,7 @@ module Docs
   class Homebrew < UrlScraper
     self.name = 'Homebrew'
     self.type = 'simple'
-    self.release = '1.8.1'
+    self.release = '2.1.9'
     self.base_url = 'https://docs.brew.sh/'
     self.links = {
       home: 'https://brew.sh',

+ 11 - 3
lib/docs/scrapers/kotlin.rb

@@ -1,7 +1,7 @@
 module Docs
   class Kotlin < UrlScraper
     self.type = 'kotlin'
-    self.release = '1.2.41'
+    self.release = '1.3.41'
     self.base_url = 'https://kotlinlang.org/'
     self.root_path = 'api/latest/jvm/stdlib/index.html'
     self.links = {
@@ -22,10 +22,18 @@ module Docs
       docs/events.html
       docs/resources.html
       docs/reference/grammar.html)
-    options[:replace_paths] = { 'api/latest/jvm/stdlib/' => 'api/latest/jvm/stdlib/index.html' }
+    options[:replace_paths] = {
+      'api/latest/jvm/stdlib/' => 'api/latest/jvm/stdlib/index.html',
+      'docs/reference/coroutines.html' => 'docs/reference/coroutines-overview.html',
+      'api/latest/jvm/stdlib/kotlin/fold.html' => 'api/latest/jvm/stdlib/kotlin.collections/fold.html',
+      'api/latest/jvm/stdlib/kotlin/get-or-else.html' => 'api/latest/jvm/stdlib/kotlin.collections/get-or-else.html',
+      'api/latest/jvm/stdlib/kotlin/map.html' => 'api/latest/jvm/stdlib/kotlin.collections/map.html',
+      'docs/tutorials/native/targeting-multiple-platforms.html' => 'docs/tutorials/native/basic-kotlin-native-app.html',
+      'api/latest/jvm/stdlib/kotlin/-throwable/print-stack-trace.html' => 'api/latest/jvm/stdlib/kotlin/print-stack-trace.html',
+    }
 
     options[:attribution] = <<-HTML
-      &copy; 2010&ndash;2018 JetBrains s.r.o.<br>
+      &copy; 2010&ndash;2019 JetBrains s.r.o.<br>
       Licensed under the Apache License, Version 2.0.
     HTML
 

+ 3 - 3
lib/docs/scrapers/padrino.rb

@@ -2,8 +2,8 @@ module Docs
   class Padrino < UrlScraper
     self.slug = 'padrino'
     self.type = 'rubydoc'
-    self.release = '0.14.1'
-    self.base_url = 'http://www.rubydoc.info/github/padrino/padrino-framework/'
+    self.release = '0.14.4'
+    self.base_url = 'https://www.rubydoc.info/github/padrino/padrino-framework/'
     self.root_path = 'file/README.rdoc'
     self.initial_paths = %w(index2)
     self.links = {
@@ -16,7 +16,7 @@ module Docs
     options[:container] = ->(filter) { filter.root_page? ? '#filecontents' : '#content' }
 
     options[:attribution] = <<-HTML
-      &copy; 2010&ndash;2016 Padrino<br>
+      &copy; 2010&ndash;2019 Padrino<br>
       Licensed under the MIT License.
     HTML
 

+ 18 - 7
lib/docs/scrapers/pandas.rb

@@ -14,40 +14,51 @@ module Docs
     options[:container] = '.document'
 
     options[:skip] = %w(internals.html release.html contributing.html whatsnew.html)
+    options[:skip_patterns] = [/whatsnew\//]
 
     options[:attribution] = <<-HTML
       &copy; 2008&ndash;2012, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team<br>
       Licensed under the 3-clause BSD License.
     HTML
 
+    version '0.25' do
+      self.release = '0.25.0'
+      self.base_url = "https://pandas.pydata.org/pandas-docs/version/#{self.release}/"
+    end
+
+    version '0.24' do
+      self.release = '0.24.2'
+      self.base_url = "https://pandas.pydata.org/pandas-docs/version/#{self.release}/"
+    end
+
     version '0.23' do
       self.release = '0.23.4'
-      self.base_url = "http://pandas.pydata.org/pandas-docs/version/#{self.release}/"
+      self.base_url = "https://pandas.pydata.org/pandas-docs/version/#{self.release}/"
     end
 
     version '0.22' do
       self.release = '0.22.0'
-      self.base_url = "http://pandas.pydata.org/pandas-docs/version/#{self.release}/"
+      self.base_url = "https://pandas.pydata.org/pandas-docs/version/#{self.release}/"
     end
 
     version '0.21' do
-      self.release = '0.21.0'
-      self.base_url = "http://pandas.pydata.org/pandas-docs/version/#{self.release}/"
+      self.release = '0.21.1'
+      self.base_url = "https://pandas.pydata.org/pandas-docs/version/#{self.release}/"
     end
 
     version '0.20' do
       self.release = '0.20.3'
-      self.base_url = "http://pandas.pydata.org/pandas-docs/version/#{self.release}/"
+      self.base_url = "https://pandas.pydata.org/pandas-docs/version/#{self.release}/"
     end
 
     version '0.19' do
       self.release = '0.19.2'
-      self.base_url = "http://pandas.pydata.org/pandas-docs/version/#{self.release}/"
+      self.base_url = "https://pandas.pydata.org/pandas-docs/version/#{self.release}/"
     end
 
     version '0.18' do
       self.release = '0.18.1'
-      self.base_url = "http://pandas.pydata.org/pandas-docs/version/#{self.release}/"
+      self.base_url = "https://pandas.pydata.org/pandas-docs/version/#{self.release}/"
     end
 
     def get_latest_version(opts)

+ 12 - 2
lib/docs/scrapers/qt.rb

@@ -103,9 +103,19 @@ module Docs
       Licensed under the GNU Free Documentation License, Version 1.3.
     HTML
 
+    version '5.13' do
+      self.release = '5.13'
+      self.base_url = 'https://doc.qt.io/qt-5.13/'
+    end
+
+    version '5.12' do
+      self.release = '5.12'
+      self.base_url = 'https://doc.qt.io/qt-5.12/'
+    end
+
     version '5.11' do
       self.release = '5.11'
-      self.base_url = 'https://doc.qt.io/qt-5/'
+      self.base_url = 'https://doc.qt.io/archives/qt-5.11/'
     end
 
     version '5.9' do
@@ -115,7 +125,7 @@ module Docs
 
     version '5.6' do
       self.release = '5.6'
-      self.base_url = 'https://doc.qt.io/qt-5.6/'
+      self.base_url = 'https://doc.qt.io/archives/qt-5.6/'
     end
 
     def get_latest_version(opts)

+ 2 - 0
lib/tasks/sprites.thor

@@ -31,6 +31,8 @@ class SpritesCLI < Thor
       item[:dark_icon_fix] = needs_dark_icon_fix(item[:icon_32], bg_color)
     end
 
+    return unless items_with_icons.length > 0
+
     log_details(items_with_icons, icons_per_row)
 
     generate_spritesheet(16, items_with_icons, 'assets/images/sprites/docs.png') {|item| item[:icon_16]}

+ 18 - 8
views/service-worker.js.erb

@@ -35,15 +35,25 @@ self.addEventListener('fetch', event => {
     const cachedResponse = await caches.match(event.request);
     if (cachedResponse) return cachedResponse;
 
-    const url = new URL(event.request.url);
+    try {
+      const response = await fetch(event.request);
 
-    <%# Attempt to return the index page from the cache if the user is visiting a url like devdocs.io/offline or devdocs.io/javascript/global_objects/array/find %>
-    <%# The index page will handle the routing %>
-    if (url.origin === location.origin && !url.pathname.includes('.')) {
-      const cachedIndex = await caches.match('/');
-      if (cachedIndex) return cachedIndex;
-    }
+      if (!response.ok) {
+        throw new Error(`The HTTP request failed with status code ${response.status}`);
+      }
+
+      return response;
+    } catch (err) {
+      const url = new URL(event.request.url);
 
-    return fetch(event.request);
+      <%# Attempt to return the index page from the cache if the user is visiting a url like devdocs.io/offline or devdocs.io/javascript/global_objects/array/find %>
+      <%# The index page will make sure the correct documentation or a proper offline page is shown  %>
+      if (url.origin === location.origin && !url.pathname.replace(/~([0-9.])+/, '').includes('.')) {
+        const cachedIndex = await caches.match('/');
+        if (cachedIndex) return cachedIndex;
+      }
+
+      throw err;
+    }
   })());
 });