History

Add redirection for MDN WindowTimers docs

Thibaut Courouble committed 9 years ago

Commit d7bfbee1 parent a13ac781 file · +13 −2Browse files

Unified · Split

lib/app.rb+13−2
@@ -300,8 +300,19 @@ class App < Sinatra::Application · 299 unmodified lines
300 300
301 get %r{\A/([\w~\.%]+)(\-[\w\-]+)?(/.*)?\z} do |doc, type, rest|301 get %r{\A/([\w~\.%]+)(\-[\w\-]+)?(/.*)?\z} do |doc, type, rest|
302 doc.sub! '%7E', '~'302 doc.sub! '%7E', '~'
303 return redirect "/#{DOC_REDIRECTS[doc]}#{type}#{rest}", 301 if DOC_REDIRECTS.key?(doc)303
304 return redirect "/angularjs/api#{rest}", 301 if doc == 'angular' && rest && rest.start_with?('/ng')304 if DOC_REDIRECTS.key?(doc)
305 return redirect "/#{DOC_REDIRECTS[doc]}#{type}#{rest}", 301
306 end
307
308 if rest && doc == 'angular' && rest.start_with?('/ng')
309 return redirect "/angularjs/api#{rest}", 301
310 end
311
312 if rest && doc == 'dom' && rest.start_with?('/windowtimers')
313 return redirect "/dom#{rest.sub('windowtimers', 'windoworworkerglobalscope')}"
314 end
315
305 return 404 unless @doc = find_doc(doc)316 return 404 unless @doc = find_doc(doc)
306 317
307 if rest.nil?318 if rest.nil?