File tree Expand file tree Collapse file tree 3 files changed +28
-29
lines changed Expand file tree Collapse file tree 3 files changed +28
-29
lines changed Original file line number Diff line number Diff line change @@ -2,11 +2,23 @@ module Docs
22 class Svelte
33 class CleanHtmlFilter < Filter
44 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+
616 at_css ( 'h1' ) . content = 'Svelte' if root_page?
717 css ( 'pre' ) . each do |node |
18+ # Remove hover popup
19+ node . css ( '.twoslash-popup-container' ) . remove ( )
820 node . content = node . css ( '.line' ) . map ( &:content ) . join ( "\n " )
9- node [ 'data-language' ] = 'javascript '
21+ node [ 'data-language' ] = 'typescript '
1022 end
1123 doc
1224 end
Original file line number Diff line number Diff line change @@ -2,29 +2,14 @@ module Docs
22 class Svelte
33 class EntriesFilter < Docs ::EntriesFilter
44 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
68 end
79
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
2813 end
2914 end
3015 end
Original file line number Diff line number Diff line change @@ -3,26 +3,28 @@ class Svelte < UrlScraper
33 self . name = 'Svelte'
44 self . slug = 'svelte'
55 self . type = 'simple'
6+ self . root_path = '/'
67 self . links = {
78 home : 'https://svelte.dev/' ,
89 code : 'https://github.com/sveltejs/svelte'
910 }
1011
11- self . root_path = 'introduction'
1212 options [ :root_title ] = 'Svelte'
1313
1414 # https://github.com/sveltejs/svelte/blob/master/LICENSE.md
1515 options [ :attribution ] = <<-HTML
16- © 2016–2023 Rich Harris and contributors< br >
16+ © 2016–2024 Rich Harris and contributors< br >
1717 Licensed under the MIT License.
1818 HTML
1919
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/'
2321 html_filters . push 'svelte/entries' , 'svelte/clean_html'
24-
22+
2523 version do
24+ self . release = '5.2.3'
25+ end
26+
27+ version '4' do
2628 self . release = '4.2.1'
2729 end
2830
You can’t perform that action at this time.
0 commit comments