History

Fix broken URLs

Thibaut Courouble committed 9 years ago

Commit 3b5eec71 parent 92584031 file · +34 −2Browse files

Unified · Split

lib/app.rb+34−2
@@ -281,6 +281,26 @@ class App < Sinatra::Application · 280 unmodified lines
281 CODE281 CODE
282 end282 end
283 283
284 %w(/maxcdn /maxcdn/).each do |path|
285 class_eval <<-CODE, __FILE__, __LINE__ + 1
286 get '#{path}' do
287 410
288 end
289 CODE
290 end
291
292 {
293 '/css-data-types/' => '/css-values-units/',
294 '/css-at-rules/' => '/?q=css%20%40',
295 '/html/article' => '/html/element/article'
296 }.each do |path, url|
297 class_eval <<-CODE, __FILE__, __LINE__ + 1
298 get '#{path}' do
299 redirect '#{url}', 301
300 end
301 CODE
302 end
303
284 get %r{\A/feed(?:\.atom)?\z} do304 get %r{\A/feed(?:\.atom)?\z} do
285 content_type 'application/atom+xml'305 content_type 'application/atom+xml'
286 settings.news_feed306 settings.news_feed
@@ -288,6 +308,8 @@ class App < Sinatra::Application · 1 unmodified line
288 308
289 DOC_REDIRECTS = {309 DOC_REDIRECTS = {
290 'iojs' => 'node',310 'iojs' => 'node',
311 'node_lts' => 'node~6_lts',
312 'node~4.2_lts' => 'node~4_lts',
291 'yii1' => 'yii~1.1',313 'yii1' => 'yii~1.1',
292 'python2' => 'python~2.7',314 'python2' => 'python~2.7',
293 'xpath' => 'xslt_xpath',315 'xpath' => 'xslt_xpath',
@@ -310,8 +332,18 @@ class App < Sinatra::Application · 16 unmodified lines
310 return redirect "/angularjs/api#{rest}", 301332 return redirect "/angularjs/api#{rest}", 301
311 end333 end
312 334
313 if rest && doc == 'dom' && rest.start_with?('/windowtimers')335 if rest && doc == 'dom'
314 return redirect "/dom#{rest.sub('windowtimers', 'windoworworkerglobalscope')}"336 if rest.start_with?('/windowtimers')
337 return redirect "/dom#{rest.sub('windowtimers', 'windoworworkerglobalscope')}", 301
338 end
339
340 if rest.start_with?('/window.')
341 return redirect "/dom#{rest.sub('window.', 'window/')}", 301
342 end
343
344 if rest.start_with?('/element.')
345 return redirect "/dom#{rest.sub('element.', 'element/')}", 301
346 end
315 end347 end
316 348
317 return 404 unless @doc = find_doc(doc)349 return 404 unless @doc = find_doc(doc)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t