Prechádzať zdrojové kódy

Fix mdn scrapers

- xslt_xpath had an error with redirection.
Enoc 4 rokov pred
rodič
commit
3cf987da8b

+ 3 - 2
lib/docs/filters/xslt_xpath/entries.rb

@@ -6,13 +6,14 @@ module Docs
         name.remove! 'XPath.'
         name.remove! 'XSLT.'
         name.remove! 'Axes.'
-        name.prepend 'xsl:' if slug =~ /\AXSLT\/[a-z]/
+        name.remove! 'Element.'
+        name.prepend 'xsl:' if slug =~ /XSLT\/Element/
         name << '()' if name.gsub!('Functions.', '')
         name
       end
 
       def get_type
-        if slug =~ /\AXSLT\/[a-z]/
+        if slug =~ /XSLT\/Element/
           'XSLT Elements'
         elsif slug.start_with?('XPath/Axes')
           'XPath Axes'

+ 1 - 1
lib/docs/scrapers/mdn/css.rb

@@ -4,7 +4,7 @@ module Docs
     self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/CSS'
     self.root_path = '/Reference'
 
-    html_filters.push 'css/clean_html', 'css/entries', 'title'
+    html_filters.push 'css/clean_html', 'css/entries'
 
     options[:root_title] = 'CSS'
 

+ 1 - 1
lib/docs/scrapers/mdn/dom.rb

@@ -4,7 +4,7 @@ module Docs
     self.name = 'DOM'
     self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/API'
 
-    html_filters.push 'dom/clean_html', 'dom/entries', 'title'
+    html_filters.push 'dom/clean_html', 'dom/entries'
 
     options[:root_title] = 'DOM'
 

+ 1 - 1
lib/docs/scrapers/mdn/javascript.rb

@@ -6,7 +6,7 @@ module Docs
     self.name = 'JavaScript'
     self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference'
 
-    html_filters.push 'javascript/clean_html', 'javascript/entries', 'title'
+    html_filters.push 'javascript/clean_html', 'javascript/entries'
 
     options[:root_title] = 'JavaScript'
 

+ 1 - 1
lib/docs/scrapers/mdn/svg.rb

@@ -6,7 +6,7 @@ module Docs
     self.name = 'SVG'
     self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/SVG'
 
-    html_filters.push 'svg/clean_html', 'svg/entries', 'title'
+    html_filters.push 'svg/clean_html', 'svg/entries'
 
     options[:root_title] = 'SVG'
 

+ 1 - 5
lib/docs/scrapers/mdn/xslt_xpath.rb

@@ -6,15 +6,11 @@ module Docs
     self.root_path = '/XSLT'
     self.initial_paths = %w(/XPath)
 
-    html_filters.push 'xslt_xpath/clean_html', 'xslt_xpath/entries', 'title'
+    html_filters.push 'xslt_xpath/clean_html', 'xslt_xpath/entries'
 
     options[:root_title] = 'XSLT'
 
     options[:only_patterns] = [/\A\/XSLT/, /\A\/XPath/]
 
-    options[:fix_urls] = ->(url) do
-      url.sub! 'https://developer.mozilla.org/en-US/docs/Web/XSLT/Element', "#{XsltXpath.base_url}/XSLT"
-      url
-    end
   end
 end