From db2d5e6bfb74a3c77fe5846399376eef2634551b Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Fri, 22 Oct 2021 18:09:52 +0200 Subject: [PATCH 01/10] compat_tables: unknown --- assets/stylesheets/pages/_mdn.scss | 3 ++- lib/docs/filters/mdn/compat_tables.rb | 13 +++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/assets/stylesheets/pages/_mdn.scss b/assets/stylesheets/pages/_mdn.scss index 10e144f3..a78b8b7c 100644 --- a/assets/stylesheets/pages/_mdn.scss +++ b/assets/stylesheets/pages/_mdn.scss @@ -107,7 +107,7 @@ code > strong { font-weight: normal; } - // Compatibility tablees + // Compatibility tables .bc-github-link { float: right; @@ -115,6 +115,7 @@ } .bc-supports-yes, .bc-supports-yes + dd, .bc-supports-yes + dd + dd { background: var(--noteGreenBackground); } + .bc-supports-unknown, .bc-supports-unknown + dd, .bc-supports-unknown + dd + dd { background: var(--noteBackground); } .bc-supports-partial, .bc-supports-partial + dd, .bc-supports-partial + dd + dd { background: var(--noteOrangeBackground); } .bc-supports-no, .bc-supports-no + dd, .bc-supports-no + dd + dd { background: var(--noteRedBackground); } diff --git a/lib/docs/filters/mdn/compat_tables.rb b/lib/docs/filters/mdn/compat_tables.rb index 8f81b488..bb243f54 100644 --- a/lib/docs/filters/mdn/compat_tables.rb +++ b/lib/docs/filters/mdn/compat_tables.rb @@ -163,15 +163,14 @@ module Docs version_added.map! do |version| if version == true - version = 'Yes' + 'Yes' elsif version == false - version = 'No' + 'No' elsif version.is_a?(String) + version else - version = '?' + '?' end - - version end if version_removed[0] @@ -179,6 +178,8 @@ module Docs else if version_added[0] == 'No' format_string = "" + elsif version_added[0] == '?' + format_string = "" else format_string = "" end @@ -201,7 +202,7 @@ module Docs end else - format_string = "
?
" + format_string = "
?
" end entry.add_child(format_string) From 09edf13d950b9d7ebc648d0e82b1bdd5ba6d6ef4 Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Fri, 22 Oct 2021 18:10:04 +0200 Subject: [PATCH 02/10] compat_tables: use Request.run --- lib/docs/filters/mdn/compat_tables.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/docs/filters/mdn/compat_tables.rb b/lib/docs/filters/mdn/compat_tables.rb index bb243f54..13695b9e 100644 --- a/lib/docs/filters/mdn/compat_tables.rb +++ b/lib/docs/filters/mdn/compat_tables.rb @@ -46,7 +46,9 @@ module Docs end def request_bcd_uris - index_json = JSON.load(Net::HTTP.get(URI(current_url.to_s + '/index.json'))) + url = current_url.to_s + '/index.json' + response = Request.run url + index_json = JSON.load response.body uris = [] @@ -63,9 +65,9 @@ module Docs return uris end - def generate_compatibility_table_wrapper(uri) - - @json_data = JSON.load(Net::HTTP.get(URI(uri)))['data'] + def generate_compatibility_table_wrapper(url) + response = Request.run url + @json_data = JSON.load(response.body)['data'] html_table = generate_basic_html_table() From 632e1f08694b5dcbca9e6ffb3cbe697803b05c3f Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Fri, 22 Oct 2021 18:14:08 +0200 Subject: [PATCH 03/10] Update SVG documentation --- lib/docs/scrapers/mdn/svg.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/docs/scrapers/mdn/svg.rb b/lib/docs/scrapers/mdn/svg.rb index 4a9de544..03859e68 100644 --- a/lib/docs/scrapers/mdn/svg.rb +++ b/lib/docs/scrapers/mdn/svg.rb @@ -3,6 +3,7 @@ module Docs prepend FixInternalUrlsBehavior prepend FixRedirectionsBehavior + # release = '2021-10-22' self.name = 'SVG' self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/SVG' From 3e391f156ee8bfb36519758162693fca89019fa3 Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Fri, 22 Oct 2021 18:14:42 +0200 Subject: [PATCH 04/10] Update XSLT & XPath documentation --- lib/docs/scrapers/mdn/xslt_xpath.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/docs/scrapers/mdn/xslt_xpath.rb b/lib/docs/scrapers/mdn/xslt_xpath.rb index 286c48f4..26a298b6 100644 --- a/lib/docs/scrapers/mdn/xslt_xpath.rb +++ b/lib/docs/scrapers/mdn/xslt_xpath.rb @@ -1,5 +1,6 @@ module Docs class XsltXpath < Mdn + # release = '2021-10-22' self.name = 'XSLT & XPath' self.slug = 'xslt_xpath' self.base_url = 'https://developer.mozilla.org/en-US/docs/Web' From c34bbc965c8ebac78c551939e74266cffb0596e9 Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Fri, 22 Oct 2021 19:07:00 +0200 Subject: [PATCH 05/10] Update HTTP documentation --- assets/javascripts/vendor/raven.js | 2 +- lib/docs/filters/http/clean_html.rb | 4 +-- lib/docs/filters/http/entries.rb | 6 ++--- lib/docs/scrapers/http.rb | 40 ++++++++++++++++++----------- 4 files changed, 31 insertions(+), 21 deletions(-) diff --git a/assets/javascripts/vendor/raven.js b/assets/javascripts/vendor/raven.js index 176ea361..9aadd5db 100644 --- a/assets/javascripts/vendor/raven.js +++ b/assets/javascripts/vendor/raven.js @@ -2222,7 +2222,7 @@ function urlencode(o) { return pairs.join('&'); } -// borrowed from https://tools.ietf.org/html/rfc3986#appendix-B +// borrowed from https://datatracker.ietf.org/doc/html/rfc3986#appendix-B // intentionally using regex and not href parsing trick because React Native and other // environments where DOM might not be available function parseUrl(url) { diff --git a/lib/docs/filters/http/clean_html.rb b/lib/docs/filters/http/clean_html.rb index 956233f4..6f93a7fc 100644 --- a/lib/docs/filters/http/clean_html.rb +++ b/lib/docs/filters/http/clean_html.rb @@ -2,7 +2,7 @@ module Docs class Http class CleanHtmlFilter < Filter def call - current_url.host == 'tools.ietf.org' ? ietf : mdn + current_url.host == 'datatracker.ietf.org' ? ietf : mdn doc end @@ -43,7 +43,7 @@ module Docs end css('.selflink').each do |node| - node.parent['id'] = node['name'] + node.parent['id'] = node['id'] node.before(node.children).remove end diff --git a/lib/docs/filters/http/entries.rb b/lib/docs/filters/http/entries.rb index 94a17849..83106efa 100644 --- a/lib/docs/filters/http/entries.rb +++ b/lib/docs/filters/http/entries.rb @@ -2,7 +2,7 @@ module Docs class Http class EntriesFilter < Docs::EntriesFilter def get_name - if current_url.host == 'tools.ietf.org' + if current_url.host == 'datatracker.ietf.org' name = at_css('h1').content name.remove! %r{\A.+\:} name.remove! %r{\A.+\-\-} @@ -22,7 +22,7 @@ module Docs end def get_type - return name if current_url.host == 'tools.ietf.org' + return name if current_url.host == 'datatracker.ietf.org' if slug.start_with?('Headers/Content-Security-Policy') 'CSP' @@ -101,7 +101,7 @@ module Docs LEVEL_3 = /\A(\d+)\.\d+\.\d+\z/ def additional_entries - return [] unless current_url.host == 'tools.ietf.org' + return [] unless current_url.host == 'datatracker.ietf.org' type = nil css('a[href^="#section-"]').each_with_object([]) do |node, entries| diff --git a/lib/docs/scrapers/http.rb b/lib/docs/scrapers/http.rb index 9d989c6a..f1fb5ab5 100644 --- a/lib/docs/scrapers/http.rb +++ b/lib/docs/scrapers/http.rb @@ -2,15 +2,25 @@ module Docs class Http < Mdn include MultipleBaseUrls + # release = '2021-10-22' self.name = 'HTTP' - self.base_urls = ['https://developer.mozilla.org/en-US/docs/Web/HTTP', 'https://tools.ietf.org/html/'] + self.base_urls = [ + 'https://developer.mozilla.org/en-US/docs/Web/HTTP', + 'https://datatracker.ietf.org/doc/html/', + ] html_filters.push 'http/clean_html', 'http/entries', 'title' options[:root_title] = 'HTTP' - options[:title] = ->(filter) { filter.current_url.host == 'tools.ietf.org' ? false : filter.default_title } - options[:container] = ->(filter) { filter.current_url.host == 'tools.ietf.org' ? '.content' : nil } - options[:skip_links] = ->(filter) { filter.current_url.host == 'tools.ietf.org' ? true : false } + options[:title] = ->(filter) do + filter.current_url.host == 'datatracker.ietf.org' ? false : filter.default_title + end + options[:container] = ->(filter) do + filter.current_url.host == 'datatracker.ietf.org' ? '.content .draftcontent' : Docs::Mdn.options[:container] + end + options[:skip_links] = ->(filter) do + filter.current_url.host == 'datatracker.ietf.org' ? true : false + end options[:replace_paths] = { '/Access_control_CORS' => '/CORS' } options[:fix_urls] = ->(url) do url.sub! %r{(Status/\d\d\d)_[A-Z].+}, '\1' @@ -18,7 +28,7 @@ module Docs end options[:attribution] = ->(filter) do - if filter.current_url.host == 'tools.ietf.org' + if filter.current_url.host == 'datatracker.ietf.org' "© document authors. All rights reserved." else Docs::Mdn.options[:attribution] @@ -27,16 +37,16 @@ module Docs def initial_urls %w(https://developer.mozilla.org/en-US/docs/Web/HTTP - https://tools.ietf.org/html/rfc2616 - https://tools.ietf.org/html/rfc4918 - https://tools.ietf.org/html/rfc7230 - https://tools.ietf.org/html/rfc7231 - https://tools.ietf.org/html/rfc7232 - https://tools.ietf.org/html/rfc7233 - https://tools.ietf.org/html/rfc7234 - https://tools.ietf.org/html/rfc7235 - https://tools.ietf.org/html/rfc7540 - https://tools.ietf.org/html/rfc5023) + https://datatracker.ietf.org/doc/html/rfc2616 + https://datatracker.ietf.org/doc/html/rfc4918 + https://datatracker.ietf.org/doc/html/rfc7230 + https://datatracker.ietf.org/doc/html/rfc7231 + https://datatracker.ietf.org/doc/html/rfc7232 + https://datatracker.ietf.org/doc/html/rfc7233 + https://datatracker.ietf.org/doc/html/rfc7234 + https://datatracker.ietf.org/doc/html/rfc7235 + https://datatracker.ietf.org/doc/html/rfc7540 + https://datatracker.ietf.org/doc/html/rfc5023) end end end From f1415f63e06ab8e81237cec6ceed296e30a643e6 Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Fri, 22 Oct 2021 19:07:28 +0200 Subject: [PATCH 06/10] Update HTML documentation --- lib/docs/scrapers/mdn/html.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/docs/scrapers/mdn/html.rb b/lib/docs/scrapers/mdn/html.rb index 1f108711..c5275c98 100644 --- a/lib/docs/scrapers/mdn/html.rb +++ b/lib/docs/scrapers/mdn/html.rb @@ -2,6 +2,7 @@ module Docs class Html < Mdn prepend FixInternalUrlsBehavior + # release = '2021-10-22' self.name = 'HTML' self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/HTML' From 3d8747d469375403be8f9d8eb4f3dbe9f6640bfe Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Fri, 22 Oct 2021 19:08:26 +0200 Subject: [PATCH 07/10] Update JavaScript documentation --- assets/stylesheets/pages/_mdn.scss | 4 ++++ lib/docs/scrapers/mdn/javascript.rb | 1 + 2 files changed, 5 insertions(+) diff --git a/assets/stylesheets/pages/_mdn.scss b/assets/stylesheets/pages/_mdn.scss index a78b8b7c..900e60bc 100644 --- a/assets/stylesheets/pages/_mdn.scss +++ b/assets/stylesheets/pages/_mdn.scss @@ -131,4 +131,8 @@ dd { margin: 0; } } + + iframe.interactive { + width: 100%; + } } diff --git a/lib/docs/scrapers/mdn/javascript.rb b/lib/docs/scrapers/mdn/javascript.rb index 8238d3b4..61f14db9 100644 --- a/lib/docs/scrapers/mdn/javascript.rb +++ b/lib/docs/scrapers/mdn/javascript.rb @@ -3,6 +3,7 @@ module Docs prepend FixInternalUrlsBehavior prepend FixRedirectionsBehavior + # release = '2021-10-22' self.name = 'JavaScript' self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference' From 45027d5a29cada751583e1c5c5056e7e6d820f08 Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Fri, 22 Oct 2021 19:28:42 +0200 Subject: [PATCH 08/10] Update CSS documentation --- lib/docs/scrapers/mdn/css.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/docs/scrapers/mdn/css.rb b/lib/docs/scrapers/mdn/css.rb index 98a126ac..265198f5 100644 --- a/lib/docs/scrapers/mdn/css.rb +++ b/lib/docs/scrapers/mdn/css.rb @@ -1,5 +1,6 @@ module Docs class Css < Mdn + # release = '2021-10-22' self.name = 'CSS' self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/CSS' self.root_path = '/Reference' From 0b0456d99fd3bfbff947021f6184dc14b75b1595 Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Fri, 22 Oct 2021 19:46:02 +0200 Subject: [PATCH 09/10] Update Web Extensions documentation --- lib/docs/scrapers/mdn/web_extensions.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/docs/scrapers/mdn/web_extensions.rb b/lib/docs/scrapers/mdn/web_extensions.rb index 1a5f528a..d9481732 100644 --- a/lib/docs/scrapers/mdn/web_extensions.rb +++ b/lib/docs/scrapers/mdn/web_extensions.rb @@ -1,5 +1,6 @@ module Docs class WebExtensions < Mdn + # release = '2021-10-22' self.name = 'Web Extensions' self.slug = 'web_extensions' self.links = { From 658762917ecb4e8c002b296a5e74e47c82f42601 Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Fri, 22 Oct 2021 21:04:39 +0200 Subject: [PATCH 10/10] Update DOM documentation --- lib/docs/scrapers/mdn/dom.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/docs/scrapers/mdn/dom.rb b/lib/docs/scrapers/mdn/dom.rb index b75af630..07eb43fe 100644 --- a/lib/docs/scrapers/mdn/dom.rb +++ b/lib/docs/scrapers/mdn/dom.rb @@ -1,6 +1,7 @@ module Docs class Dom < Mdn + # release = '2021-10-22' self.name = 'DOM' self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/API'