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
88 'https://developer.mozilla.org/en-US/docs/Web/HTTP',
99 'https://datatracker.ietf.org/doc/html/',
1010 ]
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
1120
1221 html_filters.push 'http/clean_html', 'http/entries', 'title'
1322
lib/docs/scrapers/mdn/css.rb+4−0
@@ -4,6 +4,10 @@ module Docs · 3 unmodified lines
44 self.name = 'CSS'
55 self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/CSS'
66 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+ }
711
812 html_filters.push 'css/clean_html', 'css/entries'
913
lib/docs/scrapers/mdn/dom.rb+4−0
@@ -5,6 +5,10 @@ module Docs · 4 unmodified lines
55 self.name = 'Web APIs'
66 self.slug = 'dom'
77 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+ }
812
913 html_filters.push 'dom/clean_html', 'dom/entries'
1014
lib/docs/scrapers/mdn/html.rb+4−0
@@ -5,6 +5,10 @@ module Docs · 4 unmodified lines
55 # release = '2023-01-06'
66 self.name = 'HTML'
77 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+ }
812
913 html_filters.push 'html/clean_html', 'html/entries'
1014
lib/docs/scrapers/mdn/javascript.rb+4−0
@@ -6,6 +6,10 @@ module Docs · 5 unmodified lines
66 # release = '2023-01-06'
77 self.name = 'JavaScript'
88 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+ }
913
1014 html_filters.push 'javascript/clean_html', 'javascript/entries'
1115
lib/docs/scrapers/mdn/mdn.rb+4−0
@@ -2,6 +2,10 @@ module Docs · 1 unmodified line
22 class Mdn < UrlScraper
33 self.abstract = true
44 self.type = 'mdn'
5+ self.links = {
6+ home: 'https://developer.mozilla.org',
7+ code: 'https://github.com/mdn/content'
8+ }
59
610 html_filters.push 'mdn/clean_html', 'mdn/compat_tables'
711
lib/docs/scrapers/mdn/svg.rb+4−0
@@ -6,6 +6,10 @@ module Docs · 5 unmodified lines
66 # release = '2022-09-06'
77 self.name = 'SVG'
88 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+ }
913
1014 html_filters.push 'svg/clean_html', 'svg/entries'
1115
lib/docs/scrapers/mdn/web_extensions.rb+2−2
@@ -4,9 +4,9 @@ module Docs · 3 unmodified lines
44 self.name = 'Web Extensions'
55 self.slug = 'web_extensions'
66 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'
89 }
9−
1010 self.base_url = 'https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions'
1111
1212 html_filters.push 'web_extensions/entries', 'web_extensions/clean_html'