From 46819a3e87be6ce783be0169c2b76afb4ccacd52 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 17 Dec 2018 14:11:25 +0100 Subject: [PATCH 01/30] Update Qt docs * Added Qt 5.12 docs (latest LTS release) * Use a stable URL for Qt 5.11 docs --- lib/docs/scrapers/qt.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/docs/scrapers/qt.rb b/lib/docs/scrapers/qt.rb index 412eca6d..a1c4e09b 100644 --- a/lib/docs/scrapers/qt.rb +++ b/lib/docs/scrapers/qt.rb @@ -103,9 +103,14 @@ module Docs Licensed under the GNU Free Documentation License, Version 1.3. HTML + 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/qt-5.11/' end version '5.9' do From d640a8ee221c26ad4612595157e6cbe9f0fd5709 Mon Sep 17 00:00:00 2001 From: Jasper van Merle Date: Mon, 28 Jan 2019 17:51:28 +0100 Subject: [PATCH 02/30] Set favicon to documentation icon on open --- .../javascripts/views/sidebar/doc_list.coffee | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/assets/javascripts/views/sidebar/doc_list.coffee b/assets/javascripts/views/sidebar/doc_list.coffee index c72877a8..d24c2476 100644 --- a/assets/javascripts/views/sidebar/doc_list.coffee +++ b/assets/javascripts/views/sidebar/doc_list.coffee @@ -94,6 +94,8 @@ class app.views.DocList extends app.View $.stopEvent(event) doc = app.docs.findBy 'slug', event.target.getAttribute('data-slug') + @setFaviconForDoc(doc) + if doc and not @lists[doc.slug] @lists[doc.slug] = if doc.types.isEmpty() new app.views.EntryList doc.entries.all() @@ -111,6 +113,29 @@ class app.views.DocList extends app.View delete @lists[doc.slug] return + setFaviconForDoc: (doc) -> + link = $("a._list-item[data-slug='#{doc.slug}']") + styles = window.getComputedStyle(link, ':before') + + bgUrl = styles['background-image'].slice(5, -2) + bgSize = if bgUrl.includes('@2x') then 32 else 16 + bgPositions = styles['background-position'].split(' ') + bgX = parseInt(bgPositions[0].slice(0, -2)) + bgY = parseInt(bgPositions[1].slice(0, -2)) + + img = new Image() + img.src = bgUrl + img.onload = () => + canvas = document.createElement('canvas') + + canvas.width = bgSize + canvas.height = bgSize + canvas.getContext('2d').drawImage(img, bgX, bgY) + + $('link[rel="icon"]').href = canvas.toDataURL() + return + return + select: (model) -> @listSelect.selectByHref model?.fullPath() return From c36478ce8265e480e4a0e759d1836ffdb07ced76 Mon Sep 17 00:00:00 2001 From: Jasper van Merle Date: Fri, 1 Feb 2019 09:30:19 +0100 Subject: [PATCH 03/30] Set favicon to the icon of the currently shown docs --- assets/javascripts/lib/favicon.coffee | 53 +++++++++++++++++++ .../javascripts/views/content/content.coffee | 3 ++ .../views/content/entry_page.coffee | 1 + .../views/content/type_page.coffee | 1 + .../javascripts/views/sidebar/doc_list.coffee | 25 --------- 5 files changed, 58 insertions(+), 25 deletions(-) create mode 100644 assets/javascripts/lib/favicon.coffee diff --git a/assets/javascripts/lib/favicon.coffee b/assets/javascripts/lib/favicon.coffee new file mode 100644 index 00000000..aa319e27 --- /dev/null +++ b/assets/javascripts/lib/favicon.coffee @@ -0,0 +1,53 @@ +defaultUrl = null +currentSlug = null + +imageCache = {} +urlCache = {} + +withImage = (url, action) -> + if imageCache[url] + action(imageCache[url]) + else + img = new Image() + img.src = url + img.onload = () => + imageCache[url] = img + action(img) + +@setFaviconForDoc = (doc) -> + return if currentSlug == doc.slug + + favicon = $('link[rel="icon"]') + + if urlCache[doc.slug] + favicon.href = urlCache[doc.slug] + currentSlug = doc.slug + return + + styles = window.getComputedStyle($("._icon-#{doc.slug}"), ':before') + + bgUrl = styles['background-image'].slice(5, -2) + bgSize = if bgUrl.includes('@2x') then 32 else 16 + bgX = parseInt(styles['background-position-x'].slice(0, -2)) + bgY = parseInt(styles['background-position-y'].slice(0, -2)) + + withImage(bgUrl, (img) -> + canvas = document.createElement('canvas') + + canvas.width = bgSize + canvas.height = bgSize + canvas.getContext('2d').drawImage(img, bgX, bgY) + + if defaultUrl == null + defaultUrl = favicon.href + + 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 diff --git a/assets/javascripts/views/content/content.coffee b/assets/javascripts/views/content/content.coffee index 8c5ba874..4e01733e 100644 --- a/assets/javascripts/views/content/content.coffee +++ b/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 diff --git a/assets/javascripts/views/content/entry_page.coffee b/assets/javascripts/views/content/entry_page.coffee index beae4d77..00762fa6 100644 --- a/assets/javascripts/views/content/entry_page.coffee +++ b/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 diff --git a/assets/javascripts/views/content/type_page.coffee b/assets/javascripts/views/content/type_page.coffee index 147fa7ed..ef360c14 100644 --- a/assets/javascripts/views/content/type_page.coffee +++ b/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: -> diff --git a/assets/javascripts/views/sidebar/doc_list.coffee b/assets/javascripts/views/sidebar/doc_list.coffee index d24c2476..c72877a8 100644 --- a/assets/javascripts/views/sidebar/doc_list.coffee +++ b/assets/javascripts/views/sidebar/doc_list.coffee @@ -94,8 +94,6 @@ class app.views.DocList extends app.View $.stopEvent(event) doc = app.docs.findBy 'slug', event.target.getAttribute('data-slug') - @setFaviconForDoc(doc) - if doc and not @lists[doc.slug] @lists[doc.slug] = if doc.types.isEmpty() new app.views.EntryList doc.entries.all() @@ -113,29 +111,6 @@ class app.views.DocList extends app.View delete @lists[doc.slug] return - setFaviconForDoc: (doc) -> - link = $("a._list-item[data-slug='#{doc.slug}']") - styles = window.getComputedStyle(link, ':before') - - bgUrl = styles['background-image'].slice(5, -2) - bgSize = if bgUrl.includes('@2x') then 32 else 16 - bgPositions = styles['background-position'].split(' ') - bgX = parseInt(bgPositions[0].slice(0, -2)) - bgY = parseInt(bgPositions[1].slice(0, -2)) - - img = new Image() - img.src = bgUrl - img.onload = () => - canvas = document.createElement('canvas') - - canvas.width = bgSize - canvas.height = bgSize - canvas.getContext('2d').drawImage(img, bgX, bgY) - - $('link[rel="icon"]').href = canvas.toDataURL() - return - return - select: (model) -> @listSelect.selectByHref model?.fullPath() return From 845f612effd69848fbc77ddd6f37e0a578fbb453 Mon Sep 17 00:00:00 2001 From: Nick Klauer Date: Mon, 11 Feb 2019 18:35:17 -0600 Subject: [PATCH 04/30] add Docker 18.03 Adding the updated Docker version --- lib/docs/scrapers/docker.rb | 39 +++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/lib/docs/scrapers/docker.rb b/lib/docs/scrapers/docker.rb index 92494f8a..9e457207 100644 --- a/lib/docs/scrapers/docker.rb +++ b/lib/docs/scrapers/docker.rb @@ -21,6 +21,45 @@ module Docs Docker, Inc. and other parties may also have trademark rights in other terms used herein. HTML + version '18' do + self.release = '18.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] = { + 'get-started/part1' => 'get-started/', + '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/', + '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.06' self.base_url = 'https://docs.docker.com/' From 2fde00b2506e41f8e90194e51988787e20133e14 Mon Sep 17 00:00:00 2001 From: Nick Klauer Date: Mon, 11 Feb 2019 20:41:05 -0600 Subject: [PATCH 05/30] update homebrew to 2.0.1 --- lib/docs/scrapers/homebrew.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/docs/scrapers/homebrew.rb b/lib/docs/scrapers/homebrew.rb index fba79ec0..b343e4e0 100644 --- a/lib/docs/scrapers/homebrew.rb +++ b/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.0.1' self.base_url = 'https://docs.brew.sh/' self.links = { home: 'https://brew.sh', From 3586a09e99c5bee4b45262af4b17217dd5ba6bae Mon Sep 17 00:00:00 2001 From: Lexin Gong Date: Tue, 22 Jan 2019 15:56:17 +0800 Subject: [PATCH 06/30] Update Elixir documentation (1.8.1 & 1.7.4) --- lib/docs/scrapers/elixir.rb | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/docs/scrapers/elixir.rb b/lib/docs/scrapers/elixir.rb index 10d5aac1..78a43980 100644 --- a/lib/docs/scrapers/elixir.rb +++ b/lib/docs/scrapers/elixir.rb @@ -33,8 +33,21 @@ module Docs "https://elixir-lang.org/getting-started/introduction.html" ] end + version '1.8' do + self.release = '1.8.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.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}/", From 14e49f7014523a807d01df4b04ae470c3da6c2e9 Mon Sep 17 00:00:00 2001 From: Jasper van Merle Date: Sat, 16 Feb 2019 23:41:06 +0100 Subject: [PATCH 07/30] Use GitHub's parent-child style --- assets/javascripts/lib/favicon.coffee | 36 +++++++++++++++++---------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/assets/javascripts/lib/favicon.coffee b/assets/javascripts/lib/favicon.coffee index aa319e27..f42b1281 100644 --- a/assets/javascripts/lib/favicon.coffee +++ b/assets/javascripts/lib/favicon.coffee @@ -19,6 +19,9 @@ withImage = (url, action) -> favicon = $('link[rel="icon"]') + if defaultUrl == null + defaultUrl = favicon.href + if urlCache[doc.slug] favicon.href = urlCache[doc.slug] currentSlug = doc.slug @@ -27,24 +30,31 @@ withImage = (url, action) -> styles = window.getComputedStyle($("._icon-#{doc.slug}"), ':before') bgUrl = styles['background-image'].slice(5, -2) - bgSize = if bgUrl.includes('@2x') then 32 else 16 - bgX = parseInt(styles['background-position-x'].slice(0, -2)) - bgY = parseInt(styles['background-position-y'].slice(0, -2)) + sourceSize = if bgUrl.includes('@2x') then 32 else 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, (img) -> - canvas = document.createElement('canvas') + withImage(bgUrl, (docImg) -> + withImage(defaultUrl, (defaultImg) -> + size = defaultImg.width - canvas.width = bgSize - canvas.height = bgSize - canvas.getContext('2d').drawImage(img, bgX, bgY) + canvas = document.createElement('canvas') + ctx = canvas.getContext('2d') - if defaultUrl == null - defaultUrl = favicon.href + canvas.width = size + canvas.height = size + ctx.drawImage(defaultImg, 0, 0) - urlCache[doc.slug] = canvas.toDataURL() - favicon.href = urlCache[doc.slug] + docIconPercentage = 65 + destinationCoords = size / 100 * (100 - docIconPercentage) + destinationSize = size / 100 * docIconPercentage + ctx.drawImage(docImg, sourceX, sourceY, sourceSize, sourceSize, destinationCoords, destinationCoords, destinationSize, destinationSize) - currentSlug = doc.slug + urlCache[doc.slug] = canvas.toDataURL() + favicon.href = urlCache[doc.slug] + + currentSlug = doc.slug + ) ) @resetFavicon = () -> From 5e35914d7ea2fdbedadcba7ea0dc767e3ae10a97 Mon Sep 17 00:00:00 2001 From: Leandro Doctors Date: Wed, 20 Mar 2019 08:57:07 -0300 Subject: [PATCH 08/30] Clojure: add support for v1.10 --- lib/docs/scrapers/clojure.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/docs/scrapers/clojure.rb b/lib/docs/scrapers/clojure.rb index c6bdcdea..cc183e7e 100644 --- a/lib/docs/scrapers/clojure.rb +++ b/lib/docs/scrapers/clojure.rb @@ -13,9 +13,14 @@ module Docs Licensed under the Eclipse Public License 1.0. HTML + version '1.10' do + self.release = '1.10' + self.base_url = 'https://clojure.github.io/clojure/' + end + version '1.9' do self.release = '1.9' - self.base_url = 'https://clojure.github.io/clojure/' + self.base_url = 'https://clojure.github.io/clojure/branch-clojure-1.9.0/' end version '1.8' do From 8c80bb8e31d2c591cca1c26dddb6d56b849c46be Mon Sep 17 00:00:00 2001 From: Leandro Doctors Date: Thu, 21 Mar 2019 04:19:19 -0300 Subject: [PATCH 09/30] Clojure: show version status (stable/legacy) --- lib/docs/scrapers/clojure.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/docs/scrapers/clojure.rb b/lib/docs/scrapers/clojure.rb index cc183e7e..806146a0 100644 --- a/lib/docs/scrapers/clojure.rb +++ b/lib/docs/scrapers/clojure.rb @@ -14,22 +14,22 @@ module Docs HTML version '1.10' do - self.release = '1.10' + self.release = '1.10 (stable)' self.base_url = 'https://clojure.github.io/clojure/' end version '1.9' do - self.release = '1.9' + 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 end From 4e315cf306049353b130f199019223893ea54b38 Mon Sep 17 00:00:00 2001 From: Leandro Doctors Date: Thu, 21 Mar 2019 04:21:57 -0300 Subject: [PATCH 10/30] Clojure: add support for latest development branch Currently 1.11 --- lib/docs/scrapers/clojure.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/docs/scrapers/clojure.rb b/lib/docs/scrapers/clojure.rb index 806146a0..6389f566 100644 --- a/lib/docs/scrapers/clojure.rb +++ b/lib/docs/scrapers/clojure.rb @@ -13,6 +13,11 @@ module Docs Licensed under the Eclipse Public License 1.0. HTML + version '(current master)' do + self.release = '1.11 (in development)' + self.base_url = 'https://clojure.github.io/clojure/branch-master/' + end + version '1.10' do self.release = '1.10 (stable)' self.base_url = 'https://clojure.github.io/clojure/' From ec4e867053ac428f0a9c97a0d508222119112403 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20G=C3=BCnther?= Date: Tue, 7 May 2019 08:35:25 +0200 Subject: [PATCH 11/30] Update padrino to 0.14.4 --- lib/docs/scrapers/padrino.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/docs/scrapers/padrino.rb b/lib/docs/scrapers/padrino.rb index 218f1731..04ed3f64 100644 --- a/lib/docs/scrapers/padrino.rb +++ b/lib/docs/scrapers/padrino.rb @@ -2,7 +2,7 @@ module Docs class Padrino < UrlScraper self.slug = 'padrino' self.type = 'rubydoc' - self.release = '0.14.1' + self.release = '0.14.4' self.base_url = 'http://www.rubydoc.info/github/padrino/padrino-framework/' self.root_path = 'file/README.rdoc' self.initial_paths = %w(index2) @@ -16,7 +16,7 @@ module Docs options[:container] = ->(filter) { filter.root_page? ? '#filecontents' : '#content' } options[:attribution] = <<-HTML - © 2010–2016 Padrino
+ © 2010–2019 Padrino
Licensed under the MIT License. HTML From 0ced6fee9b5933cfb0c3f72a5d29836acd3f9c9f Mon Sep 17 00:00:00 2001 From: Jaco du Plessis Date: Wed, 22 May 2019 11:44:32 +0200 Subject: [PATCH 12/30] Update Django docs versions Added 2.2 as new version and update the 1.11 LTS. --- lib/docs/scrapers/django.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/docs/scrapers/django.rb b/lib/docs/scrapers/django.rb index 45273540..7ab20f7f 100644 --- a/lib/docs/scrapers/django.rb +++ b/lib/docs/scrapers/django.rb @@ -34,8 +34,13 @@ module Docs Licensed under the BSD License. HTML + version '2.2' do + self.release = '2.2.1' + self.base_url = 'https://docs.djangoproject.com/en/2.2/' + end + version '2.1' do - self.release = '2.1.0' + self.release = '2.1.8' self.base_url = 'https://docs.djangoproject.com/en/2.1/' end @@ -45,7 +50,7 @@ module Docs end version '1.11' do - self.release = '1.11.9' + self.release = '1.11.20' self.base_url = 'https://docs.djangoproject.com/en/1.11/' end From c828b1167b5104dfdf6e11b10ffdee26db7e2b33 Mon Sep 17 00:00:00 2001 From: Matthew Dixon Date: Tue, 11 Jun 2019 17:11:31 -0400 Subject: [PATCH 13/30] Update pandas documentation (0.24.2) --- lib/docs/scrapers/pandas.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/docs/scrapers/pandas.rb b/lib/docs/scrapers/pandas.rb index 1355a012..f6b8c7a4 100644 --- a/lib/docs/scrapers/pandas.rb +++ b/lib/docs/scrapers/pandas.rb @@ -20,6 +20,11 @@ module Docs Licensed under the 3-clause BSD License. HTML + version '0.24' do + self.release = '0.24.2' + self.base_url = "http://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}/" From 47a48973a2dbc1fe3a6adc24881e03d81cde5495 Mon Sep 17 00:00:00 2001 From: Rocco Bruyn Date: Sun, 14 Jul 2019 13:13:28 +0200 Subject: [PATCH 14/30] update kotlin version to 1.3.41 --- lib/docs/scrapers/kotlin.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/docs/scrapers/kotlin.rb b/lib/docs/scrapers/kotlin.rb index 415393d1..7a22d98d 100644 --- a/lib/docs/scrapers/kotlin.rb +++ b/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 = { From 5dbb8536069b2956f9c733e627989e6806eb94e3 Mon Sep 17 00:00:00 2001 From: Jasper van Merle Date: Sun, 4 Aug 2019 02:50:19 +0200 Subject: [PATCH 15/30] Fix Docker images, sprites:generate and a favicon cors issue --- Dockerfile | 2 +- Dockerfile-alpine | 2 +- assets/javascripts/lib/favicon.coffee | 1 + lib/tasks/sprites.thor | 2 ++ 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index f59628c7..b033427a 100644 --- a/Dockerfile +++ b/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/* diff --git a/Dockerfile-alpine b/Dockerfile-alpine index b916d2b1..33a06b0e 100644 --- a/Dockerfile-alpine +++ b/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 && \ diff --git a/assets/javascripts/lib/favicon.coffee b/assets/javascripts/lib/favicon.coffee index f42b1281..176bd79c 100644 --- a/assets/javascripts/lib/favicon.coffee +++ b/assets/javascripts/lib/favicon.coffee @@ -9,6 +9,7 @@ withImage = (url, action) -> action(imageCache[url]) else img = new Image() + img.crossOrigin = 'anonymous' img.src = url img.onload = () => imageCache[url] = img diff --git a/lib/tasks/sprites.thor b/lib/tasks/sprites.thor index ca4e33bf..1c0d3600 100644 --- a/lib/tasks/sprites.thor +++ b/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]} From 8d57c48b183eede77091d98990c594e7a7cedb38 Mon Sep 17 00:00:00 2001 From: Jasper van Merle Date: Sun, 4 Aug 2019 03:01:04 +0200 Subject: [PATCH 16/30] Fix favicon when there are multiple versions --- assets/javascripts/lib/favicon.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/javascripts/lib/favicon.coffee b/assets/javascripts/lib/favicon.coffee index 176bd79c..5254b54c 100644 --- a/assets/javascripts/lib/favicon.coffee +++ b/assets/javascripts/lib/favicon.coffee @@ -28,7 +28,7 @@ withImage = (url, action) -> currentSlug = doc.slug return - styles = window.getComputedStyle($("._icon-#{doc.slug}"), ':before') + styles = window.getComputedStyle($("._icon-#{doc.slug.split('~')[0]}"), ':before') bgUrl = styles['background-image'].slice(5, -2) sourceSize = if bgUrl.includes('@2x') then 32 else 16 From c01982ca9add42352d8ffe1f9b83579d4fdd7892 Mon Sep 17 00:00:00 2001 From: Jasper van Merle Date: Sun, 4 Aug 2019 12:51:19 +0200 Subject: [PATCH 17/30] Fix favicon on HiDPI displays --- assets/javascripts/app/config.coffee.erb | 1 + assets/javascripts/lib/favicon.coffee | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/assets/javascripts/app/config.coffee.erb b/assets/javascripts/app/config.coffee.erb index dba368e0..a822f7e2 100644 --- a/assets/javascripts/app/config.coffee.erb +++ b/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' %> diff --git a/assets/javascripts/lib/favicon.coffee b/assets/javascripts/lib/favicon.coffee index 5254b54c..2f2d9f93 100644 --- a/assets/javascripts/lib/favicon.coffee +++ b/assets/javascripts/lib/favicon.coffee @@ -30,8 +30,8 @@ withImage = (url, action) -> styles = window.getComputedStyle($("._icon-#{doc.slug.split('~')[0]}"), ':before') - bgUrl = styles['background-image'].slice(5, -2) - sourceSize = if bgUrl.includes('@2x') then 32 else 16 + 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))) From b23b81e693b691e1c5776c72c8a6ca5e547deede Mon Sep 17 00:00:00 2001 From: Jasper van Merle Date: Sun, 4 Aug 2019 14:33:44 +0200 Subject: [PATCH 18/30] Rename CookieStore to CookiesStore --- assets/javascripts/app/app.coffee | 2 +- assets/javascripts/app/settings.coffee | 3 ++- .../lib/{cookie_store.coffee => cookies_store.coffee} | 6 +++++- 3 files changed, 8 insertions(+), 3 deletions(-) rename assets/javascripts/lib/{cookie_store.coffee => cookies_store.coffee} (76%) diff --git a/assets/javascripts/app/app.coffee b/assets/javascripts/app/app.coffee index 1e230368..b55e552c 100644 --- a/assets/javascripts/app/app.coffee +++ b/assets/javascripts/app/app.coffee @@ -78,7 +78,7 @@ .install() @previousErrorHandler = onerror window.onerror = @onWindowError.bind(@) - CookieStore.onBlocked = @onCookieBlocked + CookiesStore.onBlocked = @onCookieBlocked return bootOne: -> diff --git a/assets/javascripts/app/settings.coffee b/assets/javascripts/app/settings.coffee index b2734dfe..cb7e7799 100644 --- a/assets/javascripts/app/settings.coffee +++ b/assets/javascripts/app/settings.coffee @@ -33,7 +33,8 @@ class app.Settings analyticsConsent: false constructor: -> - @store = new CookieStore + @store = new CookiesStore + console.log @store @cache = {} get: (key) -> diff --git a/assets/javascripts/lib/cookie_store.coffee b/assets/javascripts/lib/cookies_store.coffee similarity index 76% rename from assets/javascripts/lib/cookie_store.coffee rename to assets/javascripts/lib/cookies_store.coffee index 3b340571..eaf1bd4f 100644 --- a/assets/javascripts/lib/cookie_store.coffee +++ b/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: -> From 45a74930c864a7106e537573cda083b5f5fd5839 Mon Sep 17 00:00:00 2001 From: Jasper van Merle Date: Sun, 4 Aug 2019 14:40:17 +0200 Subject: [PATCH 19/30] Remove forgotten console.log statement --- assets/javascripts/app/settings.coffee | 1 - 1 file changed, 1 deletion(-) diff --git a/assets/javascripts/app/settings.coffee b/assets/javascripts/app/settings.coffee index cb7e7799..350a08c0 100644 --- a/assets/javascripts/app/settings.coffee +++ b/assets/javascripts/app/settings.coffee @@ -34,7 +34,6 @@ class app.Settings constructor: -> @store = new CookiesStore - console.log @store @cache = {} get: (key) -> From d5bcd6fffa14bd9bf4aa10c070c9009e861045f4 Mon Sep 17 00:00:00 2001 From: Jasper van Merle Date: Mon, 5 Aug 2019 09:09:43 +0200 Subject: [PATCH 20/30] Update versions and filter --- lib/docs/filters/elixir/clean_html.rb | 5 +++++ lib/docs/scrapers/elixir.rb | 17 +++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/lib/docs/filters/elixir/clean_html.rb b/lib/docs/filters/elixir/clean_html.rb index 7ff3a86a..cf703389 100644 --- a/lib/docs/filters/elixir/clean_html.rb +++ b/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 diff --git a/lib/docs/scrapers/elixir.rb b/lib/docs/scrapers/elixir.rb index 076cb81d..f3cc94b2 100644 --- a/lib/docs/scrapers/elixir.rb +++ b/lib/docs/scrapers/elixir.rb @@ -33,8 +33,21 @@ 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.1' + self.release = '1.8.2' self.base_urls = [ "https://hexdocs.pm/elixir/#{release}/", "https://hexdocs.pm/eex/#{release}/", @@ -60,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}/", From ab45ef80dbd454771f1c4b43584c554df5596831 Mon Sep 17 00:00:00 2001 From: Jasper van Merle Date: Mon, 5 Aug 2019 09:27:06 +0200 Subject: [PATCH 21/30] Remove master version --- lib/docs/scrapers/clojure.rb | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lib/docs/scrapers/clojure.rb b/lib/docs/scrapers/clojure.rb index 83147ad7..5de4288e 100644 --- a/lib/docs/scrapers/clojure.rb +++ b/lib/docs/scrapers/clojure.rb @@ -13,11 +13,6 @@ module Docs Licensed under the Eclipse Public License 1.0. HTML - version '(current master)' do - self.release = '1.11 (in development)' - self.base_url = 'https://clojure.github.io/clojure/branch-master/' - end - version '1.10' do self.release = '1.10 (stable)' self.base_url = 'https://clojure.github.io/clojure/' From 9b1483505b7fa24db02a2f5fd7b6c0129897ed5c Mon Sep 17 00:00:00 2001 From: Jasper van Merle Date: Mon, 5 Aug 2019 11:15:19 +0200 Subject: [PATCH 22/30] Update url's and fix filters for 5.13 --- lib/docs/filters/qt/clean_html.rb | 1 + lib/docs/filters/qt/entries.rb | 1 + lib/docs/scrapers/qt.rb | 9 +++++++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/docs/filters/qt/clean_html.rb b/lib/docs/filters/qt/clean_html.rb index f8f7ebd0..1772a765 100644 --- a/lib/docs/filters/qt/clean_html.rb +++ b/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 diff --git a/lib/docs/filters/qt/entries.rb b/lib/docs/filters/qt/entries.rb index 64d342f1..27cd0a31 100644 --- a/lib/docs/filters/qt/entries.rb +++ b/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{^\[.*\] }) diff --git a/lib/docs/scrapers/qt.rb b/lib/docs/scrapers/qt.rb index de9f83f0..4dc2aea0 100644 --- a/lib/docs/scrapers/qt.rb +++ b/lib/docs/scrapers/qt.rb @@ -103,6 +103,11 @@ 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/' @@ -110,7 +115,7 @@ module Docs version '5.11' do self.release = '5.11' - self.base_url = 'https://doc.qt.io/qt-5.11/' + self.base_url = 'https://doc.qt.io/archives/qt-5.11/' end version '5.9' do @@ -120,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) From 7ad7247878a9e8d5c1dd4fbf4a7e1b5a542eac8c Mon Sep 17 00:00:00 2001 From: Jasper van Merle Date: Mon, 5 Aug 2019 13:18:53 +0200 Subject: [PATCH 23/30] Update version and filter --- lib/docs/filters/homebrew/clean_html.rb | 5 +++++ lib/docs/filters/homebrew/entries.rb | 4 +++- lib/docs/scrapers/homebrew.rb | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/docs/filters/homebrew/clean_html.rb b/lib/docs/filters/homebrew/clean_html.rb index 5bf6aa29..6a81a5c6 100644 --- a/lib/docs/filters/homebrew/clean_html.rb +++ b/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("

#{title}

") + end + css('div.highlighter-rouge').each do |node| lang = node['class'][/language-(\w+)/, 1] node['data-language'] = lang if lang diff --git a/lib/docs/filters/homebrew/entries.rb b/lib/docs/filters/homebrew/entries.rb index 03650ad9..c698cf72 100644 --- a/lib/docs/filters/homebrew/entries.rb +++ b/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) diff --git a/lib/docs/scrapers/homebrew.rb b/lib/docs/scrapers/homebrew.rb index faf46a76..5743735f 100644 --- a/lib/docs/scrapers/homebrew.rb +++ b/lib/docs/scrapers/homebrew.rb @@ -2,7 +2,7 @@ module Docs class Homebrew < UrlScraper self.name = 'Homebrew' self.type = 'simple' - self.release = '2.0.1' + self.release = '2.1.9' self.base_url = 'https://docs.brew.sh/' self.links = { home: 'https://brew.sh', From 7b3a1ed463ed2c2db3187a68a08cb0e20e5be4fa Mon Sep 17 00:00:00 2001 From: Jasper van Merle Date: Mon, 5 Aug 2019 17:19:11 +0200 Subject: [PATCH 24/30] Update the scraper again --- lib/docs/scrapers/docker.rb | 184 ++++++++++++++++++++++++++---------- 1 file changed, 133 insertions(+), 51 deletions(-) diff --git a/lib/docs/scrapers/docker.rb b/lib/docs/scrapers/docker.rb index 6ac8fea2..06c3344d 100644 --- a/lib/docs/scrapers/docker.rb +++ b/lib/docs/scrapers/docker.rb @@ -15,15 +15,69 @@ module Docs end options[:attribution] = <<-HTML - © 2017 Docker, Inc.
+ © 2019 Docker, Inc.
Licensed under the Apache License, Version 2.0.
Docker and the Docker logo are trademarks or registered trademarks of Docker, Inc. in the United States and/or other countries.
Docker, Inc. and other parties may also have trademark rights in other terms used herein. HTML + 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.03' - self.base_url = 'https://docs.docker.com/' + self.release = '18.09' + self.base_url = "https://docs.docker.com/v#{release}/" html_filters.push 'docker/entries', 'docker/clean_html' @@ -33,36 +87,50 @@ module Docs options[:skip_patterns] = [/\Aengine\/api\/v/, /glossary/, /docker-ee/] options[:replace_paths] = { - 'get-started/part1' => 'get-started/', - '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.06' - self.base_url = 'https://docs.docker.com/' + self.release = '17.12' + self.base_url = "https://docs.docker.com/v#{release}/" html_filters.push 'docker/entries', 'docker/clean_html' @@ -72,29 +140,43 @@ 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/', - '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/', + '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 From 96cadd449bdc0dbcf0e9cd85288257df2b79e8ef Mon Sep 17 00:00:00 2001 From: Jasper van Merle Date: Mon, 5 Aug 2019 18:29:00 +0200 Subject: [PATCH 25/30] Fix service worker for disabled docs --- views/service-worker.js.erb | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/views/service-worker.js.erb b/views/service-worker.js.erb index 8d5698a7..b4c77de6 100644 --- a/views/service-worker.js.erb +++ b/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.includes('.')) { + const cachedIndex = await caches.match('/'); + if (cachedIndex) return cachedIndex; + } + + throw err; + } })()); }); From 147745b09e7bc457fd1e57e7b8769c74652940c1 Mon Sep 17 00:00:00 2001 From: Jasper van Merle Date: Mon, 5 Aug 2019 21:02:22 +0200 Subject: [PATCH 26/30] Use https --- lib/docs/scrapers/padrino.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/docs/scrapers/padrino.rb b/lib/docs/scrapers/padrino.rb index d779286e..9653bf02 100644 --- a/lib/docs/scrapers/padrino.rb +++ b/lib/docs/scrapers/padrino.rb @@ -3,7 +3,7 @@ module Docs self.slug = 'padrino' self.type = 'rubydoc' self.release = '0.14.4' - self.base_url = 'http://www.rubydoc.info/github/padrino/padrino-framework/' + self.base_url = 'https://www.rubydoc.info/github/padrino/padrino-framework/' self.root_path = 'file/README.rdoc' self.initial_paths = %w(index2) self.links = { From 8fa1bddfdca34da690dac49b08655ac031f440ab Mon Sep 17 00:00:00 2001 From: Jasper van Merle Date: Mon, 5 Aug 2019 21:40:44 +0200 Subject: [PATCH 27/30] Update versions --- lib/docs/scrapers/django.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/docs/scrapers/django.rb b/lib/docs/scrapers/django.rb index 7b0a8000..f4996b22 100644 --- a/lib/docs/scrapers/django.rb +++ b/lib/docs/scrapers/django.rb @@ -35,22 +35,22 @@ module Docs HTML version '2.2' do - self.release = '2.2.1' + self.release = '2.2.4' self.base_url = 'https://docs.djangoproject.com/en/2.2/' end version '2.1' do - self.release = '2.1.8' + 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.20' + self.release = '1.11.23' self.base_url = 'https://docs.djangoproject.com/en/1.11/' end From 2b5fd63cf4782395ce660b0ddf70c234ab2c5971 Mon Sep 17 00:00:00 2001 From: Jasper van Merle Date: Mon, 5 Aug 2019 23:36:44 +0200 Subject: [PATCH 28/30] Update versions, use https and update filter for 0.24 and 0.25 --- lib/docs/filters/pandas/entries.rb | 8 +++++--- lib/docs/scrapers/pandas.rb | 22 ++++++++++++++-------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/lib/docs/filters/pandas/entries.rb b/lib/docs/filters/pandas/entries.rb index 2ef5a42b..badf5e22 100644 --- a/lib/docs/filters/pandas/entries.rb +++ b/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' diff --git a/lib/docs/scrapers/pandas.rb b/lib/docs/scrapers/pandas.rb index f5a2f831..e333da7f 100644 --- a/lib/docs/scrapers/pandas.rb +++ b/lib/docs/scrapers/pandas.rb @@ -14,45 +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 © 2008–2012, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
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 = "http://pandas.pydata.org/pandas-docs/version/#{self.release}/" + 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) From eb1429da12c93099df4b3a7da5f1e8ec364b4527 Mon Sep 17 00:00:00 2001 From: Jasper van Merle Date: Tue, 6 Aug 2019 00:03:58 +0200 Subject: [PATCH 29/30] Fix service worker for docs with multiple versions --- views/service-worker.js.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/service-worker.js.erb b/views/service-worker.js.erb index b4c77de6..e64e6355 100644 --- a/views/service-worker.js.erb +++ b/views/service-worker.js.erb @@ -48,7 +48,7 @@ self.addEventListener('fetch', event => { <%# 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.includes('.')) { + if (url.origin === location.origin && !url.pathname.replace(/~([0-9.])+/, '').includes('.')) { const cachedIndex = await caches.match('/'); if (cachedIndex) return cachedIndex; } From 12f102e0da2cf4e76c85875a97ac46468e0f59c6 Mon Sep 17 00:00:00 2001 From: Jasper van Merle Date: Tue, 6 Aug 2019 00:59:09 +0200 Subject: [PATCH 30/30] Update filters --- lib/docs/filters/kotlin/clean_html.rb | 7 +++++++ lib/docs/filters/kotlin/entries.rb | 4 +++- lib/docs/scrapers/kotlin.rb | 12 ++++++++++-- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/lib/docs/filters/kotlin/clean_html.rb b/lib/docs/filters/kotlin/clean_html.rb index 3ea049a3..6343e8ab 100644 --- a/lib/docs/filters/kotlin/clean_html.rb +++ b/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 = "Platform and version requirements: #{platforms.join ", "}" + wrapper.replace(platforms) + end end end end diff --git a/lib/docs/filters/kotlin/entries.rb b/lib/docs/filters/kotlin/entries.rb index 71f83327..2afb1e86 100644 --- a/lib/docs/filters/kotlin/entries.rb +++ b/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 diff --git a/lib/docs/scrapers/kotlin.rb b/lib/docs/scrapers/kotlin.rb index c68e9041..8707aee5 100644 --- a/lib/docs/scrapers/kotlin.rb +++ b/lib/docs/scrapers/kotlin.rb @@ -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 - © 2010–2018 JetBrains s.r.o.
+ © 2010–2019 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0. HTML