浏览代码

Merge pull request #1804 from freeCodeCamp/axios

Add Axios documentation (0.27.2)
Simon Legner 3 年之前
父节点
当前提交
ccce5e85d3

+ 1 - 1
assets/javascripts/news.json

@@ -1,7 +1,7 @@
 [
 [
   [
   [
     "2022-08-27",
     "2022-08-27",
-    "New documentations: <a href=\"/sanctuary/\">Sanctuary</a>, <a href=\"/requests/\">Requests</a>"
+    "New documentations: <a href=\"/sanctuary/\">Sanctuary</a>, <a href=\"/requests/\">Requests</a>, <a href=\"/axios/\">Axios</a>"
   ],
   ],
   [
   [
     "2022-05-03",
     "2022-05-03",

+ 5 - 0
assets/javascripts/templates/pages/about_tmpl.coffee

@@ -106,6 +106,11 @@ credits = [
     '2010-2018 Caolan McMahon',
     '2010-2018 Caolan McMahon',
     'MIT',
     'MIT',
     'https://raw.githubusercontent.com/caolan/async/master/LICENSE'
     'https://raw.githubusercontent.com/caolan/async/master/LICENSE'
+  ], [
+    'Axios',
+    '2014-present Matt Zabriskie',
+    'MIT',
+    'https://raw.githubusercontent.com/axios/axios/main/LICENSE'
   ], [
   ], [
     'Babel',
     'Babel',
     '2014-present Sebastian McKenzie',
     '2014-present Sebastian McKenzie',

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

@@ -0,0 +1,10 @@
+module Docs
+  class Axios
+    class CleanHtmlFilter < Filter
+      def call
+        css('.links').remove
+        doc
+      end
+    end
+  end
+end

+ 13 - 0
lib/docs/filters/axios/entries.rb

@@ -0,0 +1,13 @@
+module Docs
+  class Axios
+    class EntriesFilter < Docs::EntriesFilter
+      def get_name
+        at_css('h1').content
+      end
+
+      def get_type
+        'axios'
+      end
+    end
+  end
+end

+ 26 - 0
lib/docs/scrapers/axios.rb

@@ -0,0 +1,26 @@
+module Docs
+  class Axios < UrlScraper
+    self.type = 'simple'
+    self.links = {
+      home: 'hthttps://axios-http.com/',
+      code: 'https://github.com/axios/axios'
+    }
+    self.release = '0.27.2'
+    self.base_url = "https://axios-http.com/docs/"
+    self.initial_paths = %w(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>
+      Licensed under the MIT License.
+    HTML
+
+    def get_latest_version(opts)
+      get_latest_github_release('axios', 'axios', opts)
+    end
+  end
+end

二进制
public/icons/docs/axios/16.png


二进制
public/icons/docs/axios/16@2x.png


+ 1 - 0
public/icons/docs/axios/SOURCE

@@ -0,0 +1 @@
+https://raw.githubusercontent.com/axios/axios-docs/master/assets/favicon.png