Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

have bookmarklet preserve hash from original URL

  • Loading branch information...
commit 74b4181c483d5f213b52656563a87b7205605ba6 1 parent 9aeb37d
@mislav authored
Showing with 4 additions and 2 deletions.
  1. +3 −1 app.rb
  2. +1 −1  views/index.erb
View
4 app.rb
@@ -128,7 +128,9 @@ def page_title title = nil
get "/url/*" do
rfc = RfcDocument.resolve_url(params[:splat].first, href_resolver) { not_found }
- redirect to(rfc.id)
+ target = url(rfc.id)
+ target << '#' << params[:hash] if params[:hash]
+ redirect target
end
get "/:doc_id" do
View
2  views/index.erb
@@ -34,7 +34,7 @@
<footer class=span4>
<p>
Bookmarklet:
- <a href="javascript:window.location='<%= url('/url/') %>'+window.location">Prettify RFC</a>
+ <a href="javascript:window.location='<%= url('/url/') %>'+window.location.toString().replace('#','?hash=')">Prettify RFC</a>
</p>
<p>Coming next: PDF, EPUB &amp; Kindle formats</p>
<p>
Please sign in to comment.
Something went wrong with that request. Please try again.