History

Add redirections

Thibaut Courouble committed 9 years ago

Commit a4def6f1 parent fa2d7371 file · +22 −7Browse files

Unified · Split

lib/app.rb+22−7
@@ -322,13 +322,16 @@ class App < Sinatra::Application · 321 unmodified lines
322 end322 end
323 323
324 {324 {
325 '/tips' => '/help',325 '/tips' => '/help',
326 '/css-data-types/' => '/css-values-units/',326 '/css-data-types/' => '/css-values-units/',
327 '/css-at-rules/' => '/?q=css%20%40',327 '/css-at-rules/' => '/?q=css%20%40',
328 '/html/article' => '/html/element/article',328 '/dom/window/setinterval' => '/dom/windoworworkerglobalscope/setinterval',
329 'html-html5/' => 'html-elements/',329 '/html/article' => '/html/element/article',
330 'html-standard/' => 'html-elements/',330 '/html-html5/' => 'html-elements/',
331 '/http-status-codes/' => '/http-status/'331 '/html-standard/' => 'html-elements/',
332 '/http-status-codes/' => '/http-status/',
333 '/ruby/bignum' => '/ruby~2.3/bignum',
334 '/ruby/fixnum' => '/ruby~2.3/fixnum',
332 }.each do |path, url|335 }.each do |path, url|
333 class_eval <<-CODE, __FILE__, __LINE__ + 1336 class_eval <<-CODE, __FILE__, __LINE__ + 1
334 get '#{path}' do337 get '#{path}' do
@@ -373,6 +376,10 @@ class App < Sinatra::Application · 38 unmodified lines
373 return redirect "/dom#{rest.sub('windowtimers', 'windoworworkerglobalscope')}", 301376 return redirect "/dom#{rest.sub('windowtimers', 'windoworworkerglobalscope')}", 301
374 end377 end
375 378
379 if rest.start_with?('/window/url.')
380 return redirect "/dom#{rest.sub('window/url.', 'url/')}", 301
381 end
382
376 if rest.start_with?('/window.')383 if rest.start_with?('/window.')
377 return redirect "/dom#{rest.sub('window.', 'window/')}", 301384 return redirect "/dom#{rest.sub('window.', 'window/')}", 301
378 end385 end
@@ -380,6 +387,14 @@ class App < Sinatra::Application · 1 unmodified line
380 if rest.start_with?('/element.')387 if rest.start_with?('/element.')
381 return redirect "/dom#{rest.sub('element.', 'element/')}", 301388 return redirect "/dom#{rest.sub('element.', 'element/')}", 301
382 end389 end
390
391 if rest.start_with?('/event.')
392 return redirect "/dom#{rest.sub('event.', 'event/')}", 301
393 end
394
395 if rest.start_with?('/document.')
396 return redirect "/dom#{rest.sub('document.', 'document/')}", 301
397 end
383 end398 end
384 399
385 return 404 unless @doc = find_doc(doc)400 return 404 unless @doc = find_doc(doc)