History

Fix mdn scrapers

- xslt_xpath had an error with redirection.

Enoc committed 5 years ago

Commit 3cf987d1 parent 9a297ed6 files · +8 −11Browse files

Unified · Split

6 files
  1. lib/docs/filters/xslt_xpath/entries.rb +3 −2
  2. lib/docs/scrapers/mdn/css.rb +1 −1
  3. lib/docs/scrapers/mdn/dom.rb +1 −1
  4. lib/docs/scrapers/mdn/javascript.rb +1 −1
  5. lib/docs/scrapers/mdn/svg.rb +1 −1
  6. lib/docs/scrapers/mdn/xslt_xpath.rb +1 −5
lib/docs/filters/xslt_xpath/entries.rb+3−2
@@ -6,13 +6,14 @@ module Docs · 5 unmodified lines
6 name.remove! 'XPath.'6 name.remove! 'XPath.'
7 name.remove! 'XSLT.'7 name.remove! 'XSLT.'
8 name.remove! 'Axes.'8 name.remove! 'Axes.'
9 name.prepend 'xsl:' if slug =~ /\AXSLT\/[a-z]/9 name.remove! 'Element.'
10 name.prepend 'xsl:' if slug =~ /XSLT\/Element/
10 name << '()' if name.gsub!('Functions.', '')11 name << '()' if name.gsub!('Functions.', '')
11 name12 name
12 end13 end
13 14
14 def get_type15 def get_type
15 if slug =~ /\AXSLT\/[a-z]/16 if slug =~ /XSLT\/Element/
16 'XSLT Elements'17 'XSLT Elements'
17 elsif slug.start_with?('XPath/Axes')18 elsif slug.start_with?('XPath/Axes')
18 'XPath Axes'19 'XPath Axes'
lib/docs/scrapers/mdn/css.rb+1−1
@@ -4,7 +4,7 @@ module Docs · 3 unmodified lines
4 self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/CSS'4 self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/CSS'
5 self.root_path = '/Reference'5 self.root_path = '/Reference'
6 6
7 html_filters.push 'css/clean_html', 'css/entries', 'title'7 html_filters.push 'css/clean_html', 'css/entries'
8 8
9 options[:root_title] = 'CSS'9 options[:root_title] = 'CSS'
10 10
lib/docs/scrapers/mdn/dom.rb+1−1
@@ -4,7 +4,7 @@ module Docs · 3 unmodified lines
4 self.name = 'DOM'4 self.name = 'DOM'
5 self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/API'5 self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/API'
6 6
7 html_filters.push 'dom/clean_html', 'dom/entries', 'title'7 html_filters.push 'dom/clean_html', 'dom/entries'
8 8
9 options[:root_title] = 'DOM'9 options[:root_title] = 'DOM'
10 10
lib/docs/scrapers/mdn/javascript.rb+1−1
@@ -6,7 +6,7 @@ module Docs · 5 unmodified lines
6 self.name = 'JavaScript'6 self.name = 'JavaScript'
7 self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference'7 self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference'
8 8
9 html_filters.push 'javascript/clean_html', 'javascript/entries', 'title'9 html_filters.push 'javascript/clean_html', 'javascript/entries'
10 10
11 options[:root_title] = 'JavaScript'11 options[:root_title] = 'JavaScript'
12 12
lib/docs/scrapers/mdn/svg.rb+1−1
@@ -6,7 +6,7 @@ module Docs · 5 unmodified lines
6 self.name = 'SVG'6 self.name = 'SVG'
7 self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/SVG'7 self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/SVG'
8 8
9 html_filters.push 'svg/clean_html', 'svg/entries', 'title'9 html_filters.push 'svg/clean_html', 'svg/entries'
10 10
11 options[:root_title] = 'SVG'11 options[:root_title] = 'SVG'
12 12
lib/docs/scrapers/mdn/xslt_xpath.rb+1−5
@@ -6,15 +6,11 @@ module Docs · 5 unmodified lines
6 self.root_path = '/XSLT'6 self.root_path = '/XSLT'
7 self.initial_paths = %w(/XPath)7 self.initial_paths = %w(/XPath)
8 8
9 html_filters.push 'xslt_xpath/clean_html', 'xslt_xpath/entries', 'title'9 html_filters.push 'xslt_xpath/clean_html', 'xslt_xpath/entries'
10 10
11 options[:root_title] = 'XSLT'11 options[:root_title] = 'XSLT'
12 12
13 options[:only_patterns] = [/\A\/XSLT/, /\A\/XPath/]13 options[:only_patterns] = [/\A\/XSLT/, /\A\/XPath/]
14 14
15 options[:fix_urls] = ->(url) do
16 url.sub! 'https://developer.mozilla.org/en-US/docs/Web/XSLT/Element', "#{XsltXpath.base_url}/XSLT"
17 url
18 end
19 end15 end
20end16end