History

Update Vue.js documentation (3.2.30)

https://blog.vuejs.org/posts/vue-3-as-the-new-default.html

Simon Legner committed 4 years ago

Commit 6faab8b1 parent bb783023 files · +17 −16Browse files

Unified · Split

3 files
  1. lib/docs/filters/vue/clean_html.rb +3 −1
  2. lib/docs/filters/vue/entries_v3.rb +7 −7
  3. lib/docs/scrapers/vue.rb +7 −8
lib/docs/filters/vue/clean_html.rb+3−1
@@ -6,7 +6,8 @@ module Docs · 5 unmodified lines
6 return '<h1>Vite</h1>' if root_page?6 return '<h1>Vite</h1>' if root_page?
7 @doc = at_css('.content > div')7 @doc = at_css('.content > div')
8 else8 else
9 @doc = at_css(version == '3' ? 'main' : '.content')9 return '<h1>Vue.js</h1>' if root_page?
10 @doc = at_css(version == '3' ? 'main > div > div' : '.content')
10 end11 end
11 12
12 at_css('h1').content = 'Vue.js' if root_page?13 at_css('h1').content = 'Vue.js' if root_page?
@@ -14,6 +15,7 @@ module Docs · 1 unmodified line
14 15
15 css('.demo', '.guide-links', '.footer', '#ad').remove16 css('.demo', '.guide-links', '.footer', '#ad').remove
16 css('.header-anchor', '.page-edit', '.page-nav').remove17 css('.header-anchor', '.page-edit', '.page-nav').remove
18 css('.next-steps').remove
17 19
18 css('.custom-block-title').each do |node|20 css('.custom-block-title').each do |node|
19 node.name = 'strong'21 node.name = 'strong'
lib/docs/filters/vue/entries_v3.rb+7−7
@@ -9,9 +9,9 @@ module Docs · 8 unmodified lines
9 else9 else
10 name = at_css('h1').content10 name = at_css('h1').content
11 name = _fix_name(name)11 name = _fix_name(name)
12 subtype = at_css('.sidebar-heading.open, .sidebar-heading.active, .sidebar-link.active')12 subtype = at_css('.title-text.active')
13 index = css('.sidebar-link').to_a.index(at_css('.sidebar-link.active'))13 index = css('aside nav .link').to_a.index(at_css('aside nav .link.active'))
14 name.prepend "#{index + 1}. " if index && !slug.start_with?('api')14 name.prepend "#{index + 1}. " if index && !slug.start_with?('api') && !slug.start_with?('style-guide')
15 name.concat " (#{subtype.content.strip})" if subtype && slug.start_with?('guide')15 name.concat " (#{subtype.content.strip})" if subtype && slug.start_with?('guide')
16 name16 name
17 end17 end
@@ -26,12 +26,12 @@ module Docs · 8 unmodified lines
26 def get_type26 def get_type
27 if slug.start_with?('guide/migration')27 if slug.start_with?('guide/migration')
28 'Migration'28 'Migration'
29 elsif slug.start_with?('guide')29 elsif slug.start_with?('guide') or root_page?
30 'Guide'30 'Guide'
31 elsif slug == 'style-guide/'31 elsif slug.start_with?('style-guide')
32 'Style Guide'32 'Style Guide'
33 else33 else
34 title = at_css('.sidebar-heading.open, .sidebar-heading.active, .sidebar-link.active').content.strip34 title = at_css('.title-text.active').content.strip
35 title = _fix_name(title)35 title = _fix_name(title)
36 "API: #{title}"36 "API: #{title}"
37 end37 end
@@ -41,7 +41,7 @@ module Docs · 3 unmodified lines
41 return [] if slug.start_with?('guide')41 return [] if slug.start_with?('guide')
42 type = nil42 type = nil
43 43
44 css('h2, h3').each_with_object [] do |node, entries|44 at_css('main').css('h2, h3').each_with_object [] do |node, entries|
45 if node.name == 'h2'45 if node.name == 'h2'
46 type = node.content.strip46 type = node.content.strip
47 type = _fix_name(type)47 type = _fix_name(type)
lib/docs/scrapers/vue.rb+7−8
@@ -5,10 +5,10 @@ module Docs · 4 unmodified lines
5 self.type = 'vue'5 self.type = 'vue'
6 self.links = {6 self.links = {
7 home: 'https://vuejs.org/',7 home: 'https://vuejs.org/',
8 code: 'https://github.com/vuejs/vue'8 code: 'https://github.com/vuejs/core'
9 }9 }
10 10
11 options[:only_patterns] = [/guide\//, /api\//]11 options[:only_patterns] = [/^$/ ,/guide\//, /api\//]
12 options[:skip] = %w(guide/team.html)12 options[:skip] = %w(guide/team.html)
13 options[:skip_patterns] = [/guide\/contributing/]13 options[:skip_patterns] = [/guide\/contributing/]
14 options[:replace_paths] = { 'guide/' => 'guide/index.html' }14 options[:replace_paths] = { 'guide/' => 'guide/index.html' }
@@ -19,16 +19,15 @@ module Docs · 4 unmodified lines
19 HTML19 HTML
20 20
21 version '3' do21 version '3' do
22 self.release = '3.2.26'22 self.release = '3.2.30'
23 self.base_url = 'https://v3.vuejs.org/'23 self.base_url = 'https://vuejs.org/'
24 self.root_path = 'guide/introduction.html'24 self.initial_paths = %w(guide/introduction.html)
25 self.initial_paths = %w(api/)
26 html_filters.push 'vue/entries_v3', 'vue/clean_html'25 html_filters.push 'vue/entries_v3', 'vue/clean_html'
27 end26 end
28 27
29 version '2' do28 version '2' do
30 self.release = '2.6.12'29 self.release = '2.6.12'
31 self.base_url = 'https://vuejs.org/v2/'30 self.base_url = 'https://v2.vuejs.org/'
32 self.root_path = 'guide/index.html'31 self.root_path = 'guide/index.html'
33 self.initial_paths = %w(api/)32 self.initial_paths = %w(api/)
34 html_filters.push 'vue/entries', 'vue/clean_html'33 html_filters.push 'vue/entries', 'vue/clean_html'
@@ -43,7 +42,7 @@ module Docs · 8 unmodified lines
43 end42 end
44 43
45 def get_latest_version(opts)44 def get_latest_version(opts)
46 get_npm_version('vue', opts, 'next')45 get_npm_version('vue', opts)
47 end46 end
48 end47 end
49end48end