Переглянути джерело

Add VueUse documentation (9.4.0)

https://vueuse.org/
Simon Legner 3 роки тому
батько
коміт
9d9e8e47b9

+ 4 - 0
assets/javascripts/news.json

@@ -1,4 +1,8 @@
 [
+  [
+    "2022-11-04",
+    "New documentation: <a href=\"/vueuse/\">VueUse</a>"
+  ],
   [
     "2022-10-10",
     "New documentation: <a href=\"/astro/\">Astro</a>"

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

@@ -955,6 +955,11 @@ credits = [
     '2013-present Yuxi Evan You',
     'MIT',
     'https://raw.githubusercontent.com/vuejs/vuejs.org/master/LICENSE'
+  ], [
+    'Vueuse',
+    '2019-present Anthony Fu',
+    'MIT',
+    'https://raw.githubusercontent.com/vueuse/vueuse/main/LICENSE'
   ], [
     'Vuex',
     '2015-present Evan You',

+ 1 - 0
lib/docs/filters/vite/clean_html.rb

@@ -3,6 +3,7 @@ module Docs
     class CleanHtmlFilter < Filter
       def call
         return "<h1>Vitest</h1><p>A Vite-native unit test framework. It's fast!</p>" if root_page? && current_url.host == 'vitest.dev'
+        return "<h1>VueUse</h1><p>Collection of Vue Composition Utilities</p>" if root_page? && current_url.host == 'vueuse.org'
         return '<h1>Vite</h1>' if root_page?
         @doc = at_css('main h1').parent
 

+ 28 - 0
lib/docs/filters/vueuse/clean_html.rb

@@ -0,0 +1,28 @@
+module Docs
+  class Vueuse
+    class CleanHtmlFilter < Filter
+      def call
+        css('#demo, #contributors ~ div, #contributors, #changelog ~ div, #changelog').remove
+
+        css('.grid').each do |table|
+          table.name = 'table'
+          tr = nil
+          table.children.each do |td|
+            if td['opacity']
+              table.add_child('<tr>')
+              tr = table.last_element_child
+              td.name = 'th'
+              td.remove_attribute('opacity')
+              tr.add_child(td.remove)
+            else
+              td.name = 'td'
+              tr.add_child(td.remove)
+            end
+          end
+        end
+
+        doc
+      end
+    end
+  end
+end

+ 18 - 0
lib/docs/filters/vueuse/entries.rb

@@ -0,0 +1,18 @@
+module Docs
+  class Vueuse
+    class EntriesFilter < Docs::EntriesFilter
+      def get_name
+        name = at_css('h1').content
+        name.sub! %r{\s*#\s*}, ''
+        name
+      end
+
+      def get_type
+        return 'Guide' if slug == 'export-size'
+        return 'Guide' if slug == 'functions'
+        link = at_css('aside .link.active')
+        link.ancestors('section').at_css('.title').content
+      end
+    end
+  end
+end

+ 32 - 0
lib/docs/scrapers/vueuse.rb

@@ -0,0 +1,32 @@
+module Docs
+  class Vueuse < UrlScraper
+    self.name = 'VueUse'
+    self.slug = 'vueuse'
+    self.type = 'vueuse'
+    self.links = {
+      home: 'https://vueuse.org/',
+      code: 'https://github.com/vueuse/vueuse'
+    }
+
+    options[:skip] = %w(add-ons contributing ecosystem)
+    options[:skip_patterns] = [/index$/]
+    options[:fix_urls] = ->(url) do
+      url.sub! 'vueuse.org/use', 'vueuse.org/core/use'
+      url
+    end
+
+    options[:attribution] = <<-HTML
+      &copy; 2019-present Anthony Fu<br>
+      Licensed under the MIT License.
+    HTML
+
+    self.release = '9.4.0'
+    self.base_url = 'https://vueuse.org/'
+    self.initial_paths = %w(functions.html)
+    html_filters.push 'vueuse/entries', 'vite/clean_html', 'vueuse/clean_html'
+
+    def get_latest_version(opts)
+      get_npm_version('vueuse', opts)
+    end
+  end
+end

BIN
public/icons/docs/vueuse/16.png


BIN
public/icons/docs/vueuse/16@2x.png


+ 2 - 0
public/icons/docs/vueuse/SOURCE

@@ -0,0 +1,2 @@
+https://github.com/vueuse/vueuse/blob/main/packages/public/favicon-16x16.png
+https://github.com/vueuse/vueuse/blob/main/packages/public/favicon-32x32.png

BIN
public/icons/docs/vueuse/favicon-16x16.png