File tree Expand file tree Collapse file tree 3 files changed +26
-9
lines changed
Expand file tree Collapse file tree 3 files changed +26
-9
lines changed Original file line number Diff line number Diff line change @@ -2,8 +2,12 @@ module Docs
22 class Svelte
33 class CleanHtmlFilter < Filter
44 def call
5- @doc = at_css ( 'main > .content' )
6- at_css ( 'h1' ) . content = 'Svelte'
5+ @doc = at_css ( 'main .page.content' )
6+ at_css ( 'h1' ) . content = 'Svelte' if root_page?
7+ css ( 'pre' ) . each do |node |
8+ node . content = node . css ( '.line' ) . map ( &:content ) . join ( "\n " )
9+ node [ 'data-language' ] = 'javascript'
10+ end
711 doc
812 end
913 end
Original file line number Diff line number Diff line change @@ -2,15 +2,18 @@ module Docs
22 class Svelte
33 class EntriesFilter < Docs ::EntriesFilter
44 def get_type
5- 'Svelte'
5+ at_css ( 'ul.sidebar > li:has(.active) > span.section' ) . content
66 end
77
88 def additional_entries
9- type = 'Svelte'
109 subtype = nil
10+ css ( 'aside' ) . remove
11+ css ( '.category' ) . remove
12+ css ( '.controls' ) . remove
13+ css ( '.edit' ) . remove
14+ css ( '.permalink' ) . remove
1115 css ( 'h2, h3, h4' ) . each_with_object [ ] do |node , entries |
1216 if node . name == 'h2'
13- type = node . content . strip
1417 subtype = nil
1518 elsif node . name == 'h3'
1619 subtype = node . content . strip
@@ -19,7 +22,8 @@ def additional_entries
1922 next if type == 'Before we begin'
2023 name = node . content . strip
2124 name . concat " (#{ subtype } )" if subtype && node . name == 'h4'
22- entries << [ name , node [ 'id' ] , subtype || type ]
25+ next if name . starts_with? ( 'Example' )
26+ entries << [ name , node [ 'id' ] , get_type ]
2327 end
2428 end
2529 end
Original file line number Diff line number Diff line change @@ -8,18 +8,27 @@ class Svelte < UrlScraper
88 code : 'https://github.com/sveltejs/svelte'
99 }
1010
11+ self . root_path = 'introduction'
1112 options [ :root_title ] = 'Svelte'
1213
14+ # https://github.com/sveltejs/svelte/blob/master/LICENSE.md
1315 options [ :attribution ] = <<-HTML
14- © 2016–2022 Rich Harris and contributors< br >
16+ © 2016–2023 Rich Harris and contributors< br >
1517 Licensed under the MIT License.
1618 HTML
1719
1820 options [ :skip ] = %w( team.html plugins/ )
1921
20- self . release = '3.55.0'
21- self . base_url = 'https://svelte.dev/docs'
22+ self . base_url = 'https://svelte.dev/docs/'
2223 html_filters . push 'svelte/entries' , 'svelte/clean_html'
24+
25+ version do
26+ self . release = '4.2.1'
27+ end
28+
29+ version '3' do
30+ self . release = '3.55.0'
31+ end
2332
2433 def get_latest_version ( opts )
2534 get_npm_version ( 'svelte' , opts )
You can’t perform that action at this time.
0 commit comments