Przeglądaj źródła

axios: fix root_page

Simon Legner 3 lat temu
rodzic
commit
496225804b

+ 4 - 0
lib/docs/filters/axios/clean_html.rb

@@ -2,6 +2,10 @@ module Docs
   class Axios
     class CleanHtmlFilter < Filter
       def call
+        if root_page?
+          return '<h1>Axios</h1><p>Promise based HTTP client for the browser and node.js</p><p>Axios is a simple promise based HTTP client for the browser and node.js. Axios provides a simple to use library in a small package with a very extensible interface.</p>'
+        end
+        @doc = at_css('main > .body')
         css('.links').remove
         css('pre').each do |node|
           node.content = node.content

+ 7 - 3
lib/docs/scrapers/axios.rb

@@ -7,12 +7,10 @@ module Docs
     }
     self.release = '1.1.3'
     self.base_url = "https://axios-http.com/docs/"
-    self.initial_paths = %w(intro)
+    self.initial_paths = %w(index intro)
 
     html_filters.push 'axios/entries', 'axios/clean_html'
 
-    options[:container] = 'main > .body'
-
     # https://github.com/axios/axios-docs/blob/master/LICENSE
     options[:attribution] = <<-HTML
       &copy; 2020-present John Jakob "Jake" Sarjeant<br>
@@ -22,5 +20,11 @@ module Docs
     def get_latest_version(opts)
       get_latest_github_release('axios', 'axios', opts)
     end
+
+    private
+
+    def process_response?(response)
+      true
+    end
   end
 end