summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/doc/html/page/Template.scala
diff options
context:
space:
mode:
authorVlad Ureche <vlad.ureche@gmail.com>2012-08-25 02:01:39 +0200
committerVlad Ureche <vlad.ureche@gmail.com>2012-08-25 02:08:20 +0200
commit51b7be2fefa2b39ab404df510e5e793944d12fa1 (patch)
treef28dc5c5498bca1c3fe1d349b7134664e5ed499e /src/compiler/scala/tools/nsc/doc/html/page/Template.scala
parent07a0b702ab00223f6f849868f0982cdb7994af66 (diff)
downloadscala-51b7be2fefa2b39ab404df510e5e793944d12fa1.tar.gz
scala-51b7be2fefa2b39ab404df510e5e793944d12fa1.tar.bz2
scala-51b7be2fefa2b39ab404df510e5e793944d12fa1.zip
SI-6280 Scaladoc: Reloading preserves anchors
Scaladoc redirects from */package.html pages to index.html with the qualified package name as the anchor. This is done to pop up the left navigation panel whenever someone links directly to the page. (so users may navigate the rest of the scaladoc pages) When linking members directly, one can use */package.html#<signature>, which translates to index.html#*.package@<signature>. The problem was that the redirection javascript did not take the <signature> into account, so it would redirect to the top of the package page instead of scrolling to the member. Note: this is a layout change, so there's no test for it.
Diffstat (limited to 'src/compiler/scala/tools/nsc/doc/html/page/Template.scala')
-rw-r--r--src/compiler/scala/tools/nsc/doc/html/page/Template.scala6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/doc/html/page/Template.scala b/src/compiler/scala/tools/nsc/doc/html/page/Template.scala
index 1f68781777..24a26b2ad3 100644
--- a/src/compiler/scala/tools/nsc/doc/html/page/Template.scala
+++ b/src/compiler/scala/tools/nsc/doc/html/page/Template.scala
@@ -49,7 +49,11 @@ class Template(universe: doc.Universe, generator: DiagramGenerator, tpl: DocTemp
if(top === self) {{
var url = '{ val p = templateToPath(tpl); "../" * (p.size - 1) + "index.html" }';
var hash = '{ val p = templateToPath(tpl); (p.tail.reverse ::: List(p.head.replace(".html", ""))).mkString(".") }';
- window.location.href = url + '#' + hash;
+ var anchor = window.location.hash;
+ var anchor_opt = '';
+ if (anchor.length { scala.xml.Unparsed(">=") /* unless we use Unparsed, it gets escaped and crashes the script */ } 1)
+ anchor_opt = '@' + anchor.substring(1);
+ window.location.href = url + '#' + hash + anchor_opt;
}}
</script>
</xml:group>