History

Merge pull request #1862 from freeCodeCamp/vueuse

Add VueUse documentation (9.4.0)

Simon Legner committed 4 years ago

Commit 1a22ee32 parents e492871 9d9e8e410 files · +87 −-3Browse files

Unified · Split

10 files
  1. assets/javascripts/news.json +4 −0
  2. assets/javascripts/templates/pages/about_tmpl.coffee +5 −0
  3. lib/docs/filters/vite/clean_html.rb +1 −0
  4. lib/docs/filters/vueuse/clean_html.rb +28 −0
  5. lib/docs/filters/vueuse/entries.rb +18 −0
  6. lib/docs/scrapers/vueuse.rb +32 −0
  7. public/icons/docs/vueuse/16.png +0 −0
  8. public/icons/docs/vueuse/16@2x.png +0 −0
  9. public/icons/docs/vueuse/SOURCE +2 −0
  10. public/icons/docs/vueuse/favicon-16x16.png +0 −0
assets/javascripts/news.json+4−0
@@ -1,4 +1,8 @@
1[1[
2 [
3 "2022-11-04",
4 "New documentation: <a href=\"/vueuse/\">VueUse</a>"
5 ],
2 [6 [
3 "2022-10-10",7 "2022-10-10",
4 "New documentation: <a href=\"/astro/\">Astro</a>"8 "New documentation: <a href=\"/astro/\">Astro</a>"
assets/javascripts/templates/pages/about_tmpl.coffee+5−0
@@ -955,6 +955,11 @@ credits = [ · 954 unmodified lines
955 '2013-present Yuxi Evan You',955 '2013-present Yuxi Evan You',
956 'MIT',956 'MIT',
957 'https://raw.githubusercontent.com/vuejs/vuejs.org/master/LICENSE'957 'https://raw.githubusercontent.com/vuejs/vuejs.org/master/LICENSE'
958 ], [
959 'Vueuse',
960 '2019-present Anthony Fu',
961 'MIT',
962 'https://raw.githubusercontent.com/vueuse/vueuse/main/LICENSE'
958 ], [963 ], [
959 'Vuex',964 'Vuex',
960 '2015-present Evan You',965 '2015-present Evan You',
lib/docs/filters/vite/clean_html.rb+1−0
@@ -3,6 +3,7 @@ module Docs · 2 unmodified lines
3 class CleanHtmlFilter < Filter3 class CleanHtmlFilter < Filter
4 def call4 def call
5 return "<h1>Vitest</h1><p>A Vite-native unit test framework. It's fast!</p>" if root_page? && current_url.host == 'vitest.dev'5 return "<h1>Vitest</h1><p>A Vite-native unit test framework. It's fast!</p>" if root_page? && current_url.host == 'vitest.dev'
6 return "<h1>VueUse</h1><p>Collection of Vue Composition Utilities</p>" if root_page? && current_url.host == 'vueuse.org'
6 return '<h1>Vite</h1>' if root_page?7 return '<h1>Vite</h1>' if root_page?
7 @doc = at_css('main h1').parent8 @doc = at_css('main h1').parent
8 9
lib/docs/filters/vueuse/clean_html.rb+28−0
@@ -0,0 +1,28 @@
1module Docs
2 class Vueuse
3 class CleanHtmlFilter < Filter
4 def call
5 css('#demo, #contributors ~ div, #contributors, #changelog ~ div, #changelog').remove
6
7 css('.grid').each do |table|
8 table.name = 'table'
9 tr = nil
10 table.children.each do |td|
11 if td['opacity']
12 table.add_child('<tr>')
13 tr = table.last_element_child
14 td.name = 'th'
15 td.remove_attribute('opacity')
16 tr.add_child(td.remove)
17 else
18 td.name = 'td'
19 tr.add_child(td.remove)
20 end
21 end
22 end
23
24 doc
25 end
26 end
27 end
28end
lib/docs/filters/vueuse/entries.rb+18−0
@@ -0,0 +1,18 @@
1module Docs
2 class Vueuse
3 class EntriesFilter < Docs::EntriesFilter
4 def get_name
5 name = at_css('h1').content
6 name.sub! %r{\s*#\s*}, ''
7 name
8 end
9
10 def get_type
11 return 'Guide' if slug == 'export-size'
12 return 'Guide' if slug == 'functions'
13 link = at_css('aside .link.active')
14 link.ancestors('section').at_css('.title').content
15 end
16 end
17 end
18end
lib/docs/scrapers/vueuse.rb+32−0
@@ -0,0 +1,32 @@
1module Docs
2 class Vueuse < UrlScraper
3 self.name = 'VueUse'
4 self.slug = 'vueuse'
5 self.type = 'vueuse'
6 self.links = {
7 home: 'https://vueuse.org/',
8 code: 'https://github.com/vueuse/vueuse'
9 }
10
11 options[:skip] = %w(add-ons contributing ecosystem)
12 options[:skip_patterns] = [/index$/]
13 options[:fix_urls] = ->(url) do
14 url.sub! 'vueuse.org/use', 'vueuse.org/core/use'
15 url
16 end
17
18 options[:attribution] = <<-HTML
19 &copy; 2019-present Anthony Fu<br>
20 Licensed under the MIT License.
21 HTML
22
23 self.release = '9.4.0'
24 self.base_url = 'https://vueuse.org/'
25 self.initial_paths = %w(functions.html)
26 html_filters.push 'vueuse/entries', 'vite/clean_html', 'vueuse/clean_html'
27
28 def get_latest_version(opts)
29 get_npm_version('vueuse', opts)
30 end
31 end
32end
public/icons/docs/vueuse/16.png+0−0

Binary file not shown.

public/icons/docs/vueuse/16@2x.png+0−0

Binary file not shown.

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

Binary file not shown.