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
66 return '<h1>Vite</h1>' if root_page?
77 @doc = at_css('.content > div')
88 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')
1011 end
1112
1213 at_css('h1').content = 'Vue.js' if root_page?
@@ -14,6 +15,7 @@ module Docs · 1 unmodified line
1415
1516 css('.demo', '.guide-links', '.footer', '#ad').remove
1617 css('.header-anchor', '.page-edit', '.page-nav').remove
18+ css('.next-steps').remove
1719
1820 css('.custom-block-title').each do |node|
1921 node.name = 'strong'
lib/docs/filters/vue/entries_v3.rb+7−7
@@ -9,9 +9,9 @@ module Docs · 8 unmodified lines
99 else
1010 name = at_css('h1').content
1111 name = _fix_name(name)
12− subtype = at_css('.sidebar-heading.open, .sidebar-heading.active, .sidebar-link.active')
13− index = css('.sidebar-link').to_a.index(at_css('.sidebar-link.active'))
14− name.prepend "#{index + 1}. " if index && !slug.start_with?('api')
12+ subtype = at_css('.title-text.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') && !slug.start_with?('style-guide')
1515 name.concat " (#{subtype.content.strip})" if subtype && slug.start_with?('guide')
1616 name
1717 end
@@ -26,12 +26,12 @@ module Docs · 8 unmodified lines
2626 def get_type
2727 if slug.start_with?('guide/migration')
2828 'Migration'
29− elsif slug.start_with?('guide')
29+ elsif slug.start_with?('guide') or root_page?
3030 'Guide'
31− elsif slug == 'style-guide/'
31+ elsif slug.start_with?('style-guide')
3232 'Style Guide'
3333 else
34− title = at_css('.sidebar-heading.open, .sidebar-heading.active, .sidebar-link.active').content.strip
34+ title = at_css('.title-text.active').content.strip
3535 title = _fix_name(title)
3636 "API: #{title}"
3737 end
@@ -41,7 +41,7 @@ module Docs · 3 unmodified lines
4141 return [] if slug.start_with?('guide')
4242 type = nil
4343
44− css('h2, h3').each_with_object [] do |node, entries|
44+ at_css('main').css('h2, h3').each_with_object [] do |node, entries|
4545 if node.name == 'h2'
4646 type = node.content.strip
4747 type = _fix_name(type)
lib/docs/scrapers/vue.rb+7−8
@@ -5,10 +5,10 @@ module Docs · 4 unmodified lines
55 self.type = 'vue'
66 self.links = {
77 home: 'https://vuejs.org/',
8− code: 'https://github.com/vuejs/vue'
8+ code: 'https://github.com/vuejs/core'
99 }
1010
11− options[:only_patterns] = [/guide\//, /api\//]
11+ options[:only_patterns] = [/^$/ ,/guide\//, /api\//]
1212 options[:skip] = %w(guide/team.html)
1313 options[:skip_patterns] = [/guide\/contributing/]
1414 options[:replace_paths] = { 'guide/' => 'guide/index.html' }
@@ -19,16 +19,15 @@ module Docs · 4 unmodified lines
1919 HTML
2020
2121 version '3' do
22− self.release = '3.2.26'
23− self.base_url = 'https://v3.vuejs.org/'
24− self.root_path = 'guide/introduction.html'
25− self.initial_paths = %w(api/)
22+ self.release = '3.2.30'
23+ self.base_url = 'https://vuejs.org/'
24+ self.initial_paths = %w(guide/introduction.html)
2625 html_filters.push 'vue/entries_v3', 'vue/clean_html'
2726 end
2827
2928 version '2' do
3029 self.release = '2.6.12'
31− self.base_url = 'https://vuejs.org/v2/'
30+ self.base_url = 'https://v2.vuejs.org/'
3231 self.root_path = 'guide/index.html'
3332 self.initial_paths = %w(api/)
3433 html_filters.push 'vue/entries', 'vue/clean_html'
@@ -43,7 +42,7 @@ module Docs · 8 unmodified lines
4342 end
4443
4544 def get_latest_version(opts)
46− get_npm_version('vue', opts, 'next')
45+ get_npm_version('vue', opts)
4746 end
4847 end
4948 end