Merge pull request #2363 from ruiiiijiiiiang/feature/update-svelte-version

Updated svelte version
pull/2365/head
Simon Legner 2 months ago committed by GitHub
commit 642dea3ef5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -2,11 +2,23 @@ module Docs
class Svelte
class CleanHtmlFilter < Filter
def call
@doc = at_css('main .page.content')
@doc = at_css('main .page.content #docs-content')
# Remove title header
at_css('> header > div.breadcrumbs').remove()
# Remove extra input toggle
at_css('> aside.on-this-page input').remove()
# Remove "edit this page" link
at_css('> p.edit').remove()
# Remove footer navigation
at_css('> div.controls').remove()
at_css('h1').content = 'Svelte' if root_page?
css('pre').each do |node|
# Remove hover popup
node.css('.twoslash-popup-container').remove()
node.content = node.css('.line').map(&:content).join("\n")
node['data-language'] = 'javascript'
node['data-language'] = 'typescript'
end
doc
end

@ -2,29 +2,14 @@ module Docs
class Svelte
class EntriesFilter < Docs::EntriesFilter
def get_type
at_css('ul.sidebar > li:has(.active) > span.section').content
page = at_css("main nav ul.sidebar li ul li a[href$='#{result[:path]}']")
category = page.ancestors('li')[1]
return category.css('h3').inner_text
end
def additional_entries
subtype = nil
css('aside').remove
css('.category').remove
css('.controls').remove
css('.edit').remove
css('.permalink').remove
css('h2, h3, h4').each_with_object [] do |node, entries|
if node.name == 'h2'
subtype = nil
elsif node.name == 'h3'
subtype = node.content.strip
subtype = nil unless subtype[/Component directives|Element directives/]
end
next if type == 'Before we begin'
name = node.content.strip
name.concat " (#{subtype})" if subtype && node.name == 'h4'
next if name.starts_with?('Example')
entries << [name, node['id'], get_type]
end
def get_name
page = at_css("main nav ul.sidebar li ul li a[href$='#{result[:path]}']")
return page.inner_text
end
end
end

@ -3,26 +3,28 @@ module Docs
self.name = 'Svelte'
self.slug = 'svelte'
self.type = 'simple'
self.root_path = '/'
self.links = {
home: 'https://svelte.dev/',
code: 'https://github.com/sveltejs/svelte'
}
self.root_path = 'introduction'
options[:root_title] = 'Svelte'
# https://github.com/sveltejs/svelte/blob/master/LICENSE.md
options[:attribution] = <<-HTML
&copy; 20162023 Rich Harris and contributors<br>
&copy; 20162024 Rich Harris and contributors<br>
Licensed under the MIT License.
HTML
options[:skip] = %w(team.html plugins/)
self.base_url = 'https://svelte.dev/docs/'
self.base_url = 'https://svelte.dev/docs/svelte/'
html_filters.push 'svelte/entries', 'svelte/clean_html'
version do
self.release = '5.2.3'
end
version '4' do
self.release = '4.2.1'
end

Loading…
Cancel
Save