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
2
2
class Svelte
3
3
class CleanHtmlFilter < Filter
4
4
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
7
11
doc
8
12
end
9
13
end
Original file line number Diff line number Diff line change @@ -2,15 +2,18 @@ module Docs
2
2
class Svelte
3
3
class EntriesFilter < Docs ::EntriesFilter
4
4
def get_type
5
- 'Svelte'
5
+ at_css ( 'ul.sidebar > li:has(.active) > span.section' ) . content
6
6
end
7
7
8
8
def additional_entries
9
- type = 'Svelte'
10
9
subtype = nil
10
+ css ( 'aside' ) . remove
11
+ css ( '.category' ) . remove
12
+ css ( '.controls' ) . remove
13
+ css ( '.edit' ) . remove
14
+ css ( '.permalink' ) . remove
11
15
css ( 'h2, h3, h4' ) . each_with_object [ ] do |node , entries |
12
16
if node . name == 'h2'
13
- type = node . content . strip
14
17
subtype = nil
15
18
elsif node . name == 'h3'
16
19
subtype = node . content . strip
@@ -19,7 +22,8 @@ def additional_entries
19
22
next if type == 'Before we begin'
20
23
name = node . content . strip
21
24
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 ]
23
27
end
24
28
end
25
29
end
Original file line number Diff line number Diff line change @@ -8,18 +8,27 @@ class Svelte < UrlScraper
8
8
code : 'https://github.com/sveltejs/svelte'
9
9
}
10
10
11
+ self . root_path = 'introduction'
11
12
options [ :root_title ] = 'Svelte'
12
13
14
+ # https://github.com/sveltejs/svelte/blob/master/LICENSE.md
13
15
options [ :attribution ] = <<-HTML
14
- © 2016–2022 Rich Harris and contributors< br >
16
+ © 2016–2023 Rich Harris and contributors< br >
15
17
Licensed under the MIT License.
16
18
HTML
17
19
18
20
options [ :skip ] = %w( team.html plugins/ )
19
21
20
- self . release = '3.55.0'
21
- self . base_url = 'https://svelte.dev/docs'
22
+ self . base_url = 'https://svelte.dev/docs/'
22
23
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
23
32
24
33
def get_latest_version ( opts )
25
34
get_npm_version ( 'svelte' , opts )
You can’t perform that action at this time.
0 commit comments