File tree Expand file tree Collapse file tree 3 files changed +26
-5
lines changed Expand file tree Collapse file tree 3 files changed +26
-5
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ class CleanHtmlFilter < Filter
9
9
}
10
10
11
11
def call
12
+ @doc = at_css ( 'main' )
12
13
root_page? ? root : other
13
14
doc
14
15
end
@@ -17,6 +18,9 @@ def root
17
18
header = at_css ( 'h1' )
18
19
header . parent . before ( header ) . remove
19
20
21
+ # css('#above-the-fold-headline-code').remove
22
+ # css('#adopt-gradually-content').remove
23
+
20
24
css ( 'h4' ) . each do |node |
21
25
node . name = 'h2'
22
26
end
Original file line number Diff line number Diff line change @@ -21,8 +21,15 @@ def get_name
21
21
def get_type
22
22
if DEPRECATED_PAGES . include? slug
23
23
'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'
24
30
else
25
- name
31
+ button = at_css ( 'nav#sidebar > ul > li.open.highlighted > button' )
32
+ button ? button . content : name
26
33
end
27
34
end
28
35
@@ -39,7 +46,7 @@ def tsconfig_entries
39
46
end
40
47
41
48
def handbook_entries
42
- css ( 'h2' ) . each_with_object [ ] do |node , entries |
49
+ css ( 'h2' , 'h3:has(code)' ) . each_with_object [ ] do |node , entries |
43
50
entries << [ "#{ name } : #{ node . content } " , node [ 'id' ] ] if node [ 'id' ]
44
51
end
45
52
end
Original file line number Diff line number Diff line change @@ -4,12 +4,14 @@ class Typescript < UrlScraper
4
4
5
5
self . name = 'TypeScript'
6
6
self . type = 'typescript'
7
- self . release = '5.1 .3'
7
+ self . release = '5.3 .3'
8
8
self . base_urls = [
9
9
'https://www.typescriptlang.org/docs/handbook/' ,
10
10
'https://www.typescriptlang.org/'
11
11
]
12
12
13
+ self . root_path = 'docs/'
14
+
13
15
def initial_urls
14
16
[ 'https://www.typescriptlang.org/docs/handbook/' ,
15
17
'https://www.typescriptlang.org/tsconfig' ]
@@ -22,16 +24,24 @@ def initial_urls
22
24
23
25
html_filters . push 'typescript/entries' , 'typescript/clean_html' , 'title'
24
26
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
26
32
27
33
options [ :skip ] = [
28
34
'react-&-webpack.html'
29
35
]
30
36
31
37
options [ :skip_patterns ] = [
38
+ /\A branding/ ,
39
+ /\A community/ ,
40
+ /\A docs\Z / ,
41
+ /\A tools/ ,
32
42
/release-notes/ ,
33
43
/dt\/ search/ ,
34
- /play\/ /
44
+ /play/
35
45
]
36
46
37
47
options [ :attribution ] = <<-HTML
You can’t perform that action at this time.
0 commit comments