@@ -4,32 +4,30 @@ module Docs
44 class Angular < UrlScraper
55 self . type = 'angular'
66 self . links = {
7- home : 'https://angular.io /' ,
7+ home : 'https://angular.dev /' ,
88 code : 'https://github.com/angular/angular'
99 }
1010 self . base_url = 'https://angular.io/'
1111 self . root_path = 'docs'
1212
13- html_filters . push 'angular/clean_html' , 'angular/entries'
14-
1513 options [ :max_image_size ] = 256_000
1614
1715 options [ :attribution ] = <<-HTML
18- © 2010–2023 Google, Inc .< br >
19- Licensed under the Creative Commons Attribution License 4.0.
16+ Super-powered by Google ©2010–2025 .< br / >
17+ Code licensed under an MIT-style License. Documentation licensed under CC BY 4.0.
2018 HTML
2119
2220 options [ :follow_links ] = false
23- options [ :only_patterns ] = [ /\A guide/ , /\A tutorial / , /\A api / ]
21+ options [ :only_patterns ] = [ /\A guide/ , /\A api / , /\A cli / ]
2422 options [ :fix_urls_before_parse ] = -> ( url ) do
2523 url . sub! %r{\A guide/} , '/guide/'
26- url . sub! %r{\A tutorial/} , '/tutorial/'
2724 url . sub! %r{\A api/} , '/api/'
25+ url . sub! %r{\c li/} , '/cli/'
2826 url . sub! %r{\A generated/} , '/generated/'
2927 url
3028 end
3129
32- module Common
30+ module JsonNavigation
3331 private
3432
3533 def initial_urls
@@ -79,91 +77,166 @@ def url_for(path)
7977 path = path . gsub ( /[A-Z_]/ ) { |s | s . downcase + '_' }
8078 super
8179 end
82- include Docs ::Angular ::Common
80+ include Docs ::Angular ::JsonNavigation
81+ end
82+
83+ module Since18
84+ def self . handle_redirects ( version )
85+ lambda do |url |
86+ url . sub! '/guide/templates/reference-variables' , '/guide/templates/variables#template-reference-variables'
87+ url . sub! '/guide/signals/inputs' , '/guide/components/inputs'
88+ url . sub! '/guide/defer' , '/guide/templates/defer'
89+ url . sub! '/guide/templates/class-binding' , '/guide/templates/binding#css-class-and-style-property-bindings'
90+ url . sub! %r{/guide/components$} , '/guide/components/anatomy-of-components'
91+ url . sub! '/guide/templates/property-binding' , '/guide/templates/binding#binding-dynamic-properties-and-attributes'
92+ url . sub! %r{/guide/ngmodules$} , '/guide/ngmodules/overview'
93+ url . sub! '/guide/components/importing' , '/guide/components/anatomy-of-components#using-components'
94+
95+ url . sub! '/guide/components/anatomy-of-components' , '/guide/components' if version == '20'
96+
97+ url
98+ end
99+ end
83100 end
84101
85102 version do
103+ self . release = '20.3.4'
104+ self . base_url = 'https://angular.dev/'
105+ self . root_path = 'overview'
106+
107+ options [ :follow_links ] = true
108+ options [ :container ] = '.docs-app-main-content'
109+ options [ :fix_urls ] = Since18 . handle_redirects ( self . version )
110+
111+ html_filters . push 'angular/entries' , 'angular/clean_html_v18'
112+
113+ include Docs ::Angular ::Since18
114+ end
115+
116+ version '19' do
117+ self . release = '19.2.15'
118+ self . base_url = 'https://v19.angular.dev/'
119+ self . root_path = 'overview'
120+
121+ options [ :follow_links ] = true
122+ options [ :container ] = '.docs-app-main-content'
123+ options [ :fix_urls ] = Since18 . handle_redirects ( self . version )
124+
125+ html_filters . push 'angular/entries' , 'angular/clean_html_v18'
126+
127+ include Docs ::Angular ::Since18
128+ end
129+
130+ version '18' do
131+ self . release = '18.2.14'
132+ self . base_url = 'https://v18.angular.dev/'
133+ self . root_path = 'overview'
134+
135+ options [ :follow_links ] = true
136+ options [ :container ] = '.docs-app-main-content'
137+ options [ :fix_urls ] = Since18 . handle_redirects ( self . version )
138+
139+ html_filters . push 'angular/entries' , 'angular/clean_html_v18'
140+
141+ include Docs ::Angular ::Since18
142+ end
143+
144+ version '17' do
86145 self . release = '17.0.8'
87- self . base_url = 'https://angular.io/'
146+ self . base_url = 'https://v17.angular.io/'
147+ html_filters . push 'angular/clean_html' , 'angular/entries'
88148 include Docs ::Angular ::Since12
89149 end
90150
91151 version '16' do
92152 self . release = '16.2.12'
93153 self . base_url = 'https://v16.angular.io/'
154+ html_filters . push 'angular/clean_html' , 'angular/entries'
94155 include Docs ::Angular ::Since12
95156 end
96157
97158 version '15' do
98159 self . release = '15.2.9'
99160 self . base_url = 'https://v15.angular.io/'
161+ html_filters . push 'angular/clean_html' , 'angular/entries'
100162 include Docs ::Angular ::Since12
101163 end
102164
103165 version '14' do
104166 self . release = '14.2.12'
105167 self . base_url = 'https://v14.angular.io/'
168+ html_filters . push 'angular/clean_html' , 'angular/entries'
106169 include Docs ::Angular ::Since12
107170 end
108171
109172 version '13' do
110173 self . release = '13.3.8'
111174 self . base_url = 'https://v13.angular.io/'
175+ html_filters . push 'angular/clean_html' , 'angular/entries'
112176 include Docs ::Angular ::Since12
113177 end
114178
115179 version '12' do
116180 self . release = '12.2.13'
117181 self . base_url = 'https://v12.angular.io/'
182+ html_filters . push 'angular/clean_html' , 'angular/entries'
118183 include Docs ::Angular ::Since12
119184 end
120185
121186 version '11' do
122187 self . release = '11.2.14'
123188 self . base_url = 'https://v11.angular.io/'
124- include Docs ::Angular ::Common
189+ html_filters . push 'angular/clean_html' , 'angular/entries'
190+ include Docs ::Angular ::JsonNavigation
125191 end
126192
127193 version '10' do
128194 self . release = '10.2.3'
129195 self . base_url = 'https://v10.angular.io/'
130- include Docs ::Angular ::Common
196+ html_filters . push 'angular/clean_html' , 'angular/entries'
197+ include Docs ::Angular ::JsonNavigation
131198 end
132199
133200 version '9' do
134201 self . release = '9.1.12'
135202 self . base_url = 'https://v9.angular.io/'
136- include Docs ::Angular ::Common
203+ html_filters . push 'angular/clean_html' , 'angular/entries'
204+ include Docs ::Angular ::JsonNavigation
137205 end
138206
139207 version '8' do
140208 self . release = '8.2.14'
141209 self . base_url = 'https://v8.angular.io/'
142- include Docs ::Angular ::Common
210+ html_filters . push 'angular/clean_html' , 'angular/entries'
211+ include Docs ::Angular ::JsonNavigation
143212 end
144213
145214 version '7' do
146215 self . release = '7.2.15'
147216 self . base_url = 'https://v7.angular.io/'
148- include Docs ::Angular ::Common
217+ html_filters . push 'angular/clean_html' , 'angular/entries'
218+ include Docs ::Angular ::JsonNavigation
149219 end
150220
151221 version '6' do
152222 self . release = '6.1.10'
153223 self . base_url = 'https://v6.angular.io/'
154- include Docs ::Angular ::Common
224+ html_filters . push 'angular/clean_html' , 'angular/entries'
225+ include Docs ::Angular ::JsonNavigation
155226 end
156227
157228 version '5' do
158229 self . release = '5.2.11'
159230 self . base_url = 'https://v5.angular.io/'
160- include Docs ::Angular ::Common
231+ html_filters . push 'angular/clean_html' , 'angular/entries'
232+ include Docs ::Angular ::JsonNavigation
161233 end
162234
163235 version '4' do
164236 self . release = '4.4.6'
165237 self . base_url = 'https://v4.angular.io/'
166- include Docs ::Angular ::Common
238+ html_filters . push 'angular/clean_html' , 'angular/entries'
239+ include Docs ::Angular ::JsonNavigation
167240 end
168241
169242 version '2' do
0 commit comments