Update Vite documentation (2.8.3)

pull/1709/head
Simon Legner 3 years ago
parent 028d028d5c
commit d6aed8ec75

@ -0,0 +1,50 @@
module Docs
class Vite
class CleanHtmlFilter < Filter
def call
return '<h1>Vite</h1>' if root_page?
@doc = at_css('main .content > div')
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 CodePen div
css('.codepen').each do |node|
next if node.previous_element.nil?
span = node.css('span:contains("See the Pen")').remove
node.previous_element.add_child(' ')
node.previous_element.add_child(span)
node.remove
end
# Remove code highlighting
css('figure').each do |node|
node.name = 'pre'
node.content = node.at_css('td.code pre').css('.line').map(&:content).join("\n")
node['data-language'] = node['class'][/highlight (\w+)/, 1]
end
css('.line-numbers-wrapper').remove
css('pre').each do |node|
node.content = node.content.strip
node['data-language'] = 'javascript'
end
css('iframe').each do |node|
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
css('details').each do |node|
node.name = 'div'
end
doc
end
end
end
end

@ -0,0 +1,23 @@
module Docs
class Vite
class EntriesFilter < Docs::EntriesFilter
def get_name
name = at_css('h1').content
name.sub! %r{\s*#\s*}, ''
name
end
def get_type
at_css('header nav .item.active').content.strip
end
def additional_entries
css('h2, h3').each_with_object [] do |node, entries|
type = node.content.strip
type.sub! %r{\s*#\s*}, ''
entries << ["#{name}: #{type}", node['id']]
end
end
end
end
end

@ -8,7 +8,6 @@ module Docs
code: 'https://github.com/vitejs/vite' code: 'https://github.com/vitejs/vite'
} }
options[:container] = 'main'
options[:root_title] = 'Vite' options[:root_title] = 'Vite'
options[:attribution] = <<-HTML options[:attribution] = <<-HTML
@ -16,10 +15,10 @@ module Docs
Licensed under the MIT License. Licensed under the MIT License.
HTML HTML
self.release = '2.7.5' self.release = '2.8.3'
self.base_url = 'https://vitejs.dev/' self.base_url = 'https://vitejs.dev/'
self.initial_paths = %w(guide/) self.initial_paths = %w(guide/)
html_filters.push 'vue/entries_v3', 'vue/clean_html' html_filters.push 'vite/entries', 'vite/clean_html'
def get_latest_version(opts) def get_latest_version(opts)
get_npm_version('vite', opts) get_npm_version('vite', opts)

Loading…
Cancel
Save