Update Vue.js documentation (2.6.12 and 3.0.5)

pull/1474/head
Simon Legner 4 years ago
parent b724e81d2f
commit c49736bad6

@ -2,4 +2,9 @@
@extend %simple; @extend %simple;
p.tip { @extend %note; } p.tip { @extend %note; }
.custom-block {
@extend %note;
&.tip { @extend %note-green; }
&.info { @extend %note-blue; }
}
} }

@ -2,12 +2,17 @@ module Docs
class Vue class Vue
class CleanHtmlFilter < Filter class CleanHtmlFilter < Filter
def call def call
@doc = at_css('.content') @doc = at_css(version == '3' ? 'main' : '.content')
at_css('h1').content = 'Vue.js' if root_page? at_css('h1').content = 'Vue.js' if root_page?
doc.child.before('<h1>Vue.js API</h1>') if slug == 'api/' || slug == 'api/index' doc.child.before('<h1>Vue.js API</h1>') if slug == 'api/' || slug == 'api/index'
css('.demo', '.guide-links', '.footer', '#ad').remove css('.demo', '.guide-links', '.footer', '#ad').remove
css('.header-anchor', '.page-edit', '.page-nav').remove
css('.custom-block-title').each do |node|
node.name = 'strong'
end
# Remove code highlighting # Remove code highlighting
css('figure').each do |node| css('figure').each do |node|
@ -16,6 +21,7 @@ module Docs
node['data-language'] = node['class'][/highlight (\w+)/, 1] node['data-language'] = node['class'][/highlight (\w+)/, 1]
end end
css('.line-numbers-wrapper').remove
css('pre').each do |node| css('pre').each do |node|
node.content = node.content.strip node.content = node.content.strip
node['data-language'] = 'javascript' node['data-language'] = 'javascript'
@ -23,6 +29,7 @@ module Docs
css('iframe').each do |node| css('iframe').each do |node|
node['sandbox'] = 'allow-forms allow-scripts allow-same-origin' node['sandbox'] = 'allow-forms allow-scripts allow-same-origin'
node.remove if node['src'][/player.vimeo.com/] # https://v3.vuejs.org/guide/migration/introduction.html#overview
end end
css('details').each do |node| css('details').each do |node|

@ -0,0 +1,55 @@
module Docs
class Vue
class EntriesV3Filter < Docs::EntriesFilter
def get_name
if slug == 'api/' || slug == 'api/index'
'API'
elsif slug == 'style-guide/'
'Style Guide'
else
name = at_css('h1').content
name.sub! %r{#\s*}, ''
index = css('.sidebar-link').to_a.index(at_css('.sidebar-link.active'))
name.prepend "#{index + 1}. " if index
name
end
end
def get_type
if slug.start_with?('guide/migration')
'Migration'
elsif slug.start_with?('guide')
subtype = at_css('.sidebar-heading.open, .sidebar-link.active')
subtype ? "Guide: #{subtype.content}": 'Guide'
elsif slug == 'style-guide/'
'Style Guide'
else
'API'
end
end
def additional_entries
return [] if slug.start_with?('guide')
type = nil
css('h2, h3').each_with_object [] do |node, entries|
if node.name == 'h2'
type = node.content.strip
type.sub! %r{#\s*}, ''
next if slug == 'style-guide/'
title = at_css('h1').content.strip
title.sub! %r{#\s*}, ''
entries << [type, node['id'], "API: #{title}"]
elsif slug == 'style-guide/'
name = node.content.strip
name.sub! %r{#\s*}, ''
name.sub! %r{\(.*\)}, '()'
name.sub! /(essential|strongly recommended|recommended|use with caution)\Z/, ''
curent_type = "Style Guide: #{type.sub(/Rules: /, ': ')}"
entries << [name, node['id'], curent_type]
end
end
end
end
end
end

@ -8,8 +8,6 @@ module Docs
code: 'https://github.com/vuejs/vue' code: 'https://github.com/vuejs/vue'
} }
html_filters.push 'vue/entries', 'vue/clean_html'
options[:only_patterns] = [/guide\//, /api\//] options[:only_patterns] = [/guide\//, /api\//]
options[:skip] = %w(guide/team.html) options[:skip] = %w(guide/team.html)
options[:replace_paths] = { 'guide/' => 'guide/index.html' } options[:replace_paths] = { 'guide/' => 'guide/index.html' }
@ -19,11 +17,20 @@ module Docs
Licensed under the MIT License. Licensed under the MIT License.
HTML HTML
version '3' do
self.release = '3.0.5'
self.base_url = 'https://v3.vuejs.org/'
self.root_path = 'guide/introduction.html'
self.initial_paths = %w(api/)
html_filters.push 'vue/entries_v3', 'vue/clean_html'
end
version '2' do version '2' do
self.release = '2.6.10' self.release = '2.6.12'
self.base_url = 'https://vuejs.org/v2/' self.base_url = 'https://vuejs.org/v2/'
self.root_path = 'guide/index.html' self.root_path = 'guide/index.html'
self.initial_paths = %w(api/) self.initial_paths = %w(api/)
html_filters.push 'vue/entries', 'vue/clean_html'
end end
version '1' do version '1' do
@ -31,10 +38,11 @@ module Docs
self.base_url = 'https://v1.vuejs.org' self.base_url = 'https://v1.vuejs.org'
self.root_path = '/guide/index.html' self.root_path = '/guide/index.html'
self.initial_paths = %w(/api/index.html) self.initial_paths = %w(/api/index.html)
html_filters.push 'vue/entries', 'vue/clean_html'
end end
def get_latest_version(opts) def get_latest_version(opts)
get_latest_github_release('vuejs', 'vue-next', opts) get_npm_version('vue', opts, 'next')
end end
end end
end end

Loading…
Cancel
Save