File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ class CleanHtmlFilter < Filter
99 }
1010
1111 def call
12+ @doc = at_css ( 'main' )
1213 root_page? ? root : other
1314 doc
1415 end
@@ -17,6 +18,9 @@ def root
1718 header = at_css ( 'h1' )
1819 header . parent . before ( header ) . remove
1920
21+ # css('#above-the-fold-headline-code').remove
22+ # css('#adopt-gradually-content').remove
23+
2024 css ( 'h4' ) . each do |node |
2125 node . name = 'h2'
2226 end
Original file line number Diff line number Diff line change @@ -21,8 +21,15 @@ def get_name
2121 def get_type
2222 if DEPRECATED_PAGES . include? slug
2323 'Handbook (deprecated)'
24+ elsif slug . include? ( 'declaration-files' )
25+ 'Declaration Files'
26+ elsif slug == 'download'
27+ 'Handbook'
28+ elsif slug == 'why-create-typescript'
29+ 'Handbook'
2430 else
25- name
31+ button = at_css ( 'nav#sidebar > ul > li.open.highlighted > button' )
32+ button ? button . content : name
2633 end
2734 end
2835
@@ -39,7 +46,7 @@ def tsconfig_entries
3946 end
4047
4148 def handbook_entries
42- css ( 'h2' ) . each_with_object [ ] do |node , entries |
49+ css ( 'h2' , 'h3:has(code)' ) . each_with_object [ ] do |node , entries |
4350 entries << [ "#{ name } : #{ node . content } " , node [ 'id' ] ] if node [ 'id' ]
4451 end
4552 end
Original file line number Diff line number Diff line change @@ -4,12 +4,14 @@ class Typescript < UrlScraper
44
55 self . name = 'TypeScript'
66 self . type = 'typescript'
7- self . release = '5.1 .3'
7+ self . release = '5.3 .3'
88 self . base_urls = [
99 'https://www.typescriptlang.org/docs/handbook/' ,
1010 'https://www.typescriptlang.org/'
1111 ]
1212
13+ self . root_path = 'docs/'
14+
1315 def initial_urls
1416 [ 'https://www.typescriptlang.org/docs/handbook/' ,
1517 'https://www.typescriptlang.org/tsconfig' ]
@@ -22,16 +24,24 @@ def initial_urls
2224
2325 html_filters . push 'typescript/entries' , 'typescript/clean_html' , 'title'
2426
25- options [ :container ] = 'main'
27+ options [ :fix_urls_before_parse ] = -> ( url ) do
28+ url . sub! '/docs/handbook/esm-node.html' , '/docs/handbook/modules/reference.html#node16-nodenext'
29+ url . sub! '/docs/handbook/modules.html' , '/docs/handbook/modules/introduction.html'
30+ url
31+ end
2632
2733 options [ :skip ] = [
2834 'react-&-webpack.html'
2935 ]
3036
3137 options [ :skip_patterns ] = [
38+ /\A branding/ ,
39+ /\A community/ ,
40+ /\A docs\Z / ,
41+ /\A tools/ ,
3242 /release-notes/ ,
3343 /dt\/ search/ ,
34- /play\/ /
44+ /play/
3545 ]
3646
3747 options [ :attribution ] = <<-HTML
You can’t perform that action at this time.
0 commit comments