diff --git a/assets/javascripts/news.json b/assets/javascripts/news.json index 1dbc759f..df52090b 100644 --- a/assets/javascripts/news.json +++ b/assets/javascripts/news.json @@ -1,4 +1,8 @@ [ + [ + "2022-11-04", + "New documentation: VueUse" + ], [ "2022-10-10", "New documentation: Astro" diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index 5d883ab0..7ca88895 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/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', diff --git a/lib/docs/filters/vite/clean_html.rb b/lib/docs/filters/vite/clean_html.rb index 76917658..39583b91 100644 --- a/lib/docs/filters/vite/clean_html.rb +++ b/lib/docs/filters/vite/clean_html.rb @@ -3,6 +3,7 @@ module Docs class CleanHtmlFilter < Filter def call return "

Vitest

A Vite-native unit test framework. It's fast!

" if root_page? && current_url.host == 'vitest.dev' + return "

VueUse

Collection of Vue Composition Utilities

" if root_page? && current_url.host == 'vueuse.org' return '

Vite

' if root_page? @doc = at_css('main h1').parent diff --git a/lib/docs/filters/vueuse/clean_html.rb b/lib/docs/filters/vueuse/clean_html.rb new file mode 100644 index 00000000..9e8788f4 --- /dev/null +++ b/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 = 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 diff --git a/lib/docs/filters/vueuse/entries.rb b/lib/docs/filters/vueuse/entries.rb new file mode 100644 index 00000000..289c9c3d --- /dev/null +++ b/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 diff --git a/lib/docs/scrapers/vueuse.rb b/lib/docs/scrapers/vueuse.rb new file mode 100644 index 00000000..2ce00d8e --- /dev/null +++ b/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 + © 2019-present Anthony Fu
+ 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 diff --git a/public/icons/docs/vueuse/16.png b/public/icons/docs/vueuse/16.png new file mode 100644 index 00000000..fd44a6bb Binary files /dev/null and b/public/icons/docs/vueuse/16.png differ diff --git a/public/icons/docs/vueuse/16@2x.png b/public/icons/docs/vueuse/16@2x.png new file mode 100644 index 00000000..2ab84424 Binary files /dev/null and b/public/icons/docs/vueuse/16@2x.png differ diff --git a/public/icons/docs/vueuse/SOURCE b/public/icons/docs/vueuse/SOURCE new file mode 100644 index 00000000..cbe45ed1 --- /dev/null +++ b/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 diff --git a/public/icons/docs/vueuse/favicon-16x16.png b/public/icons/docs/vueuse/favicon-16x16.png new file mode 100644 index 00000000..c3db4e7e Binary files /dev/null and b/public/icons/docs/vueuse/favicon-16x16.png differ