@@ -5,59 +5,72 @@ class Godot < UrlScraper
5
5
home : 'https://godotengine.org/' ,
6
6
code : 'https://github.com/godotengine/godot'
7
7
}
8
+ # godot docs since 3.5 don't link everything from the index.
9
+ self . initial_paths = %w[
10
+ getting_started/introduction/index.html
11
+ getting_started/step_by_step/index.html
12
+ classes/index.html
13
+ ]
8
14
9
- options [ :container ] = '.document .section'
10
-
15
+ options [ :container ] = '.document > [itemprop="articleBody"]'
11
16
options [ :download_images ] = false
12
- options [ :only_patterns ] = [ /\A getting_started\/ / , /\A classes\/ / ]
17
+ options [ :only_patterns ] = [ %r{\A getting_started/} , %r{\A classes/} ]
18
+
19
+ options [ :attribution ] = <<-HTML
20
+ © 2014–present Juan Linietsky, Ariel Manzur and the Godot community< br >
21
+ Licensed under the Creative Commons Attribution Unported License v3.0.
22
+ HTML
13
23
14
- options [ :attribution ] = -> ( filter ) do
15
- if filter . subpath . start_with? ( 'classes' )
16
- <<-HTML
17
- © 2014–2022 Juan Linietsky, Ariel Manzur, Godot Engine contributors< br >
18
- Licensed under the MIT License.
19
- HTML
20
- else
21
- <<-HTML
22
- © 2014–2022 Juan Linietsky, Ariel Manzur and the Godot community< br >
23
- Licensed under the Creative Commons Attribution Unported License v3.0.
24
- HTML
25
- end
24
+ version '4.2' do
25
+ self . release = '4.2.2'
26
+ self . base_url = "https://docs.godotengine.org/en/#{ self . version } /"
27
+ html_filters . push 'godot/entries' , 'godot/clean_html' , 'sphinx/clean_html'
26
28
end
27
29
28
30
version '3.5' do
29
- self . release = '3.5.1 '
31
+ self . release = '3.5.3 '
30
32
self . base_url = "https://docs.godotengine.org/en/#{ self . version } /"
31
- options [ :container ] = '.document > [itemprop="articleBody"] > section[id]'
33
+
34
+ # godot 3.5 upstream docs are formatted like godot4
32
35
html_filters . push 'godot/entries' , 'godot/clean_html' , 'sphinx/clean_html'
33
36
end
34
37
35
38
version '3.4' do
36
39
self . release = '3.4.5'
37
40
self . base_url = "https://docs.godotengine.org/en/#{ self . version } /"
41
+
38
42
options [ :container ] = '.document > [itemprop="articleBody"] > section[id]'
39
- html_filters . push 'godot/entries ' , 'godot/clean_html ' , 'sphinx/clean_html'
43
+ html_filters . push 'godot/entries_v3 ' , 'godot/clean_html_v3 ' , 'sphinx/clean_html'
40
44
end
41
45
42
46
version '3.3' do
43
47
self . release = '3.3.0'
44
48
self . base_url = "https://docs.godotengine.org/en/#{ self . version } /"
45
- html_filters . push 'godot/entries' , 'godot/clean_html' , 'sphinx/clean_html'
49
+ self . initial_paths = %w[ /index.html ]
50
+
51
+ options [ :only_patterns ] = [ %r{\A classes/} ]
52
+ options [ :container ] = '.document .section'
53
+ html_filters . push 'godot/entries_v3' , 'godot/clean_html_v3' , 'sphinx/clean_html'
46
54
end
47
55
48
56
version '3.2' do
49
57
self . release = '3.2.3'
50
58
self . base_url = "https://docs.godotengine.org/en/#{ self . version } /"
51
- html_filters . push 'godot/entries' , 'godot/clean_html' , 'sphinx/clean_html'
59
+ self . initial_paths = %w[ /index.html ]
60
+
61
+ options [ :only_patterns ] = [ %r{\A classes/} ]
62
+ options [ :container ] = '.document .section'
63
+ html_filters . push 'godot/entries_v3' , 'godot/clean_html_v3' , 'sphinx/clean_html'
52
64
end
53
65
54
66
version '2.1' do
55
67
self . release = '2.1.6'
56
68
self . base_url = "https://docs.godotengine.org/en/#{ self . version } /"
69
+ self . initial_paths = %w[ /index.html ]
57
70
58
71
options [ :skip ] = %w( classes/class_@global\ scope.html )
59
- options [ :only_patterns ] = [ / \A learning\/ / , / \A classes\/ / ]
60
-
72
+ options [ :only_patterns ] = [ %r{ \A learning/} , %r{ \A classes/} ]
73
+ options [ :container ] = '.document .section'
61
74
html_filters . push 'godot/entries_v2' , 'godot/clean_html_v2' , 'sphinx/clean_html'
62
75
end
63
76
0 commit comments