History

Merge pull request #1966 from Elchi3/mdn-home-code

Add links.{code,home} for MDN scrapers

Simon Legner committed 3 years ago

Commit ecb1bfc2 parents 676da0e 7041e0b8 files · +35 −2Browse files

Unified · Split

8 files
  1. lib/docs/scrapers/http.rb +9 −0
  2. lib/docs/scrapers/mdn/css.rb +4 −0
  3. lib/docs/scrapers/mdn/dom.rb +4 −0
  4. lib/docs/scrapers/mdn/html.rb +4 −0
  5. lib/docs/scrapers/mdn/javascript.rb +4 −0
  6. lib/docs/scrapers/mdn/mdn.rb +4 −0
  7. lib/docs/scrapers/mdn/svg.rb +4 −0
  8. lib/docs/scrapers/mdn/web_extensions.rb +2 −2
lib/docs/scrapers/http.rb+9−0
@@ -8,6 +8,15 @@ module Docs · 7 unmodified lines
8 'https://developer.mozilla.org/en-US/docs/Web/HTTP',8 'https://developer.mozilla.org/en-US/docs/Web/HTTP',
9 'https://datatracker.ietf.org/doc/html/',9 'https://datatracker.ietf.org/doc/html/',
10 ]10 ]
11 self.links = {
12 home: 'https://developer.mozilla.org/en-US/docs/Web/HTTP',
13 code: 'https://github.com/mdn/content/tree/main/files/en-us/web/http'
14 }
15
16 options[:attribution] = <<-HTML
17 &copy; 2005&ndash;2023 MDN contributors.<br>
18 Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
19 HTML
11 20
12 html_filters.push 'http/clean_html', 'http/entries', 'title'21 html_filters.push 'http/clean_html', 'http/entries', 'title'
13 22
lib/docs/scrapers/mdn/css.rb+4−0
@@ -4,6 +4,10 @@ module Docs · 3 unmodified lines
4 self.name = 'CSS'4 self.name = 'CSS'
5 self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/CSS'5 self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/CSS'
6 self.root_path = '/Reference'6 self.root_path = '/Reference'
7 self.links = {
8 home: 'https://developer.mozilla.org/en-US/docs/Web/CSS',
9 code: 'https://github.com/mdn/content/tree/main/files/en-us/web/css'
10 }
7 11
8 html_filters.push 'css/clean_html', 'css/entries'12 html_filters.push 'css/clean_html', 'css/entries'
9 13
lib/docs/scrapers/mdn/dom.rb+4−0
@@ -5,6 +5,10 @@ module Docs · 4 unmodified lines
5 self.name = 'Web APIs'5 self.name = 'Web APIs'
6 self.slug = 'dom'6 self.slug = 'dom'
7 self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/API'7 self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/API'
8 self.links = {
9 home: 'https://developer.mozilla.org/en-US/docs/Web/API',
10 code: 'https://github.com/mdn/content/tree/main/files/en-us/web/api'
11 }
8 12
9 html_filters.push 'dom/clean_html', 'dom/entries'13 html_filters.push 'dom/clean_html', 'dom/entries'
10 14
lib/docs/scrapers/mdn/html.rb+4−0
@@ -5,6 +5,10 @@ module Docs · 4 unmodified lines
5 # release = '2023-01-06'5 # release = '2023-01-06'
6 self.name = 'HTML'6 self.name = 'HTML'
7 self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/HTML'7 self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/HTML'
8 self.links = {
9 home: 'https://developer.mozilla.org/en-US/docs/Web/HTML',
10 code: 'https://github.com/mdn/content/tree/main/files/en-us/web/html'
11 }
8 12
9 html_filters.push 'html/clean_html', 'html/entries'13 html_filters.push 'html/clean_html', 'html/entries'
10 14
lib/docs/scrapers/mdn/javascript.rb+4−0
@@ -6,6 +6,10 @@ module Docs · 5 unmodified lines
6 # release = '2023-01-06'6 # release = '2023-01-06'
7 self.name = 'JavaScript'7 self.name = 'JavaScript'
8 self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference'8 self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference'
9 self.links = {
10 home: 'https://developer.mozilla.org/en-US/docs/Web/JavaScript',
11 code: 'https://github.com/mdn/content/tree/main/files/en-us/web/javascript'
12 }
9 13
10 html_filters.push 'javascript/clean_html', 'javascript/entries'14 html_filters.push 'javascript/clean_html', 'javascript/entries'
11 15
lib/docs/scrapers/mdn/mdn.rb+4−0
@@ -2,6 +2,10 @@ module Docs · 1 unmodified line
2 class Mdn < UrlScraper2 class Mdn < UrlScraper
3 self.abstract = true3 self.abstract = true
4 self.type = 'mdn'4 self.type = 'mdn'
5 self.links = {
6 home: 'https://developer.mozilla.org',
7 code: 'https://github.com/mdn/content'
8 }
5 9
6 html_filters.push 'mdn/clean_html', 'mdn/compat_tables'10 html_filters.push 'mdn/clean_html', 'mdn/compat_tables'
7 11
lib/docs/scrapers/mdn/svg.rb+4−0
@@ -6,6 +6,10 @@ module Docs · 5 unmodified lines
6 # release = '2022-09-06'6 # release = '2022-09-06'
7 self.name = 'SVG'7 self.name = 'SVG'
8 self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/SVG'8 self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/SVG'
9 self.links = {
10 home: 'https://developer.mozilla.org/en-US/docs/Web/SVG',
11 code: 'https://github.com/mdn/content/tree/main/files/en-us/web/svg'
12 }
9 13
10 html_filters.push 'svg/clean_html', 'svg/entries'14 html_filters.push 'svg/clean_html', 'svg/entries'
11 15
lib/docs/scrapers/mdn/web_extensions.rb+2−2
@@ -4,9 +4,9 @@ module Docs · 3 unmodified lines
4 self.name = 'Web Extensions'4 self.name = 'Web Extensions'
5 self.slug = 'web_extensions'5 self.slug = 'web_extensions'
6 self.links = {6 self.links = {
7 home: 'https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions'7 home: 'https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions',
8 code: 'https://github.com/mdn/content/tree/main/files/en-us/mozilla/add-ons/webextensions'
8 }9 }
9
10 self.base_url = 'https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions'10 self.base_url = 'https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions'
11 11
12 html_filters.push 'web_extensions/entries', 'web_extensions/clean_html'12 html_filters.push 'web_extensions/entries', 'web_extensions/clean_html'