@@ -5,59 +5,72 @@ class Godot < UrlScraper
55 home : 'https://godotengine.org/' ,
66 code : 'https://github.com/godotengine/godot'
77 }
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+ ]
814
9- options [ :container ] = '.document .section'
10-
15+ options [ :container ] = '.document > [itemprop="articleBody"]'
1116 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
1323
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'
2628 end
2729
2830 version '3.5' do
29- self . release = '3.5.1 '
31+ self . release = '3.5.3 '
3032 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
3235 html_filters . push 'godot/entries' , 'godot/clean_html' , 'sphinx/clean_html'
3336 end
3437
3538 version '3.4' do
3639 self . release = '3.4.5'
3740 self . base_url = "https://docs.godotengine.org/en/#{ self . version } /"
41+
3842 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'
4044 end
4145
4246 version '3.3' do
4347 self . release = '3.3.0'
4448 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'
4654 end
4755
4856 version '3.2' do
4957 self . release = '3.2.3'
5058 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'
5264 end
5365
5466 version '2.1' do
5567 self . release = '2.1.6'
5668 self . base_url = "https://docs.godotengine.org/en/#{ self . version } /"
69+ self . initial_paths = %w[ /index.html ]
5770
5871 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'
6174 html_filters . push 'godot/entries_v2' , 'godot/clean_html_v2' , 'sphinx/clean_html'
6275 end
6376
0 commit comments