Skip to content

Commit

Permalink
when building back link, separate page name and fragment to avoid ‘#’…
Browse files Browse the repository at this point in the history
… being escaped
  • Loading branch information
yorkxin committed Jun 14, 2014
1 parent 048fda8 commit cafcdb3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/doc_page.rb
Expand Up @@ -121,10 +121,15 @@ def body_content
doc_content
}
if @back
# Encode page name and fragment name separately so that
# the fragment indicator '#' won't be escaped.
page_name, fragment = @back.split('#')
back_url = [URI.escape(page_name), URI.escape(fragment)].join('#')

div.back {
text I18n.t("general.back_to") + " "
a(class: "back", href: URI.escape(@back)) do
text Titleizer.title_for_page(@back.split('#').first)
a(class: "back", href: back_url) do
text Titleizer.title_for_page(page_name)
end
}
end
Expand Down

0 comments on commit cafcdb3

Please sign in to comment.