File tree Expand file tree Collapse file tree 4 files changed +27
-32
lines changed Expand file tree Collapse file tree 4 files changed +27
-32
lines changed Original file line number Diff line number Diff line change 88
88
rb-inotify (0.10.1 )
89
89
ffi (~> 1.0 )
90
90
redcarpet (3.6.0 )
91
- rexml (3.2.9 )
92
- strscan
91
+ rexml (3.3.9 )
93
92
rouge (1.11.1 )
94
93
rr (3.1.1 )
95
94
rss (0.3.1 )
125
124
unicode-display_width (>= 1.5 , < 3.0 )
126
125
unicode_utils (~> 1.4 )
127
126
strings-ansi (0.2.0 )
128
- strscan (1.0.3 )
129
127
terminal-table (3.0.2 )
130
128
unicode-display_width (>= 1.1.1 , < 3 )
131
129
terser (1.2.4 )
Original file line number Diff line number Diff line change @@ -2,11 +2,21 @@ module Docs
2
2
class Svelte
3
3
class CleanHtmlFilter < Filter
4
4
def call
5
- @doc = at_css ( 'main .page.content' )
5
+ @doc = at_css ( 'main .page.content #docs-content' )
6
+
7
+ # Remove title header
8
+ at_css ( '> header > div.breadcrumbs' ) . remove ( )
9
+ # Remove extra input toggle
10
+ at_css ( '> aside.on-this-page input' ) . remove ( )
11
+ # Remove "edit this page" link
12
+ at_css ( '> p.edit' ) . remove ( )
13
+ # Remove footer navigation
14
+ at_css ( '> div.controls' ) . remove ( )
15
+
6
16
at_css ( 'h1' ) . content = 'Svelte' if root_page?
7
17
css ( 'pre' ) . each do |node |
8
18
node . content = node . css ( '.line' ) . map ( &:content ) . join ( "\n " )
9
- node [ 'data-language' ] = 'javascript '
19
+ node [ 'data-language' ] = 'typescript '
10
20
end
11
21
doc
12
22
end
Original file line number Diff line number Diff line change @@ -2,29 +2,14 @@ module Docs
2
2
class Svelte
3
3
class EntriesFilter < Docs ::EntriesFilter
4
4
def get_type
5
- at_css ( 'ul.sidebar > li:has(.active) > span.section' ) . content
5
+ page = at_css ( "main nav ul.sidebar li ul li a[href$='#{ result [ :path ] } ']" )
6
+ category = page . ancestors ( 'li' ) [ 1 ]
7
+ return category . css ( 'h3' ) . inner_text
6
8
end
7
9
8
- def additional_entries
9
- subtype = nil
10
- css ( 'aside' ) . remove
11
- css ( '.category' ) . remove
12
- css ( '.controls' ) . remove
13
- css ( '.edit' ) . remove
14
- css ( '.permalink' ) . remove
15
- css ( 'h2, h3, h4' ) . each_with_object [ ] do |node , entries |
16
- if node . name == 'h2'
17
- subtype = nil
18
- elsif node . name == 'h3'
19
- subtype = node . content . strip
20
- subtype = nil unless subtype [ /Component directives|Element directives/ ]
21
- end
22
- next if type == 'Before we begin'
23
- name = node . content . strip
24
- name . concat " (#{ subtype } )" if subtype && node . name == 'h4'
25
- next if name . starts_with? ( 'Example' )
26
- entries << [ name , node [ 'id' ] , get_type ]
27
- end
10
+ def get_name
11
+ page = at_css ( "main nav ul.sidebar li ul li a[href$='#{ result [ :path ] } ']" )
12
+ return page . inner_text
28
13
end
29
14
end
30
15
end
Original file line number Diff line number Diff line change @@ -3,26 +3,28 @@ class Svelte < UrlScraper
3
3
self . name = 'Svelte'
4
4
self . slug = 'svelte'
5
5
self . type = 'simple'
6
+ self . root_path = '/'
6
7
self . links = {
7
8
home : 'https://svelte.dev/' ,
8
9
code : 'https://github.com/sveltejs/svelte'
9
10
}
10
11
11
- self . root_path = 'introduction'
12
12
options [ :root_title ] = 'Svelte'
13
13
14
14
# https://github.com/sveltejs/svelte/blob/master/LICENSE.md
15
15
options [ :attribution ] = <<-HTML
16
- © 2016–2023 Rich Harris and contributors< br >
16
+ © 2016–2024 Rich Harris and contributors< br >
17
17
Licensed under the MIT License.
18
18
HTML
19
19
20
- options [ :skip ] = %w( team.html plugins/ )
21
-
22
- self . base_url = 'https://svelte.dev/docs/'
20
+ self . base_url = 'https://svelte.dev/docs/svelte/'
23
21
html_filters . push 'svelte/entries' , 'svelte/clean_html'
24
-
22
+
25
23
version do
24
+ self . release = '5.2.3'
25
+ end
26
+
27
+ version '4' do
26
28
self . release = '4.2.1'
27
29
end
28
30
You can’t perform that action at this time.
0 commit comments