From 3f0bce95fffcea60b3cbf8bc9e0c9a410f732cde Mon Sep 17 00:00:00 2001 From: Kato Kazuyoshi Date: Tue, 8 Jan 2013 01:22:34 +0900 Subject: SI-6017 Generate Scaladoc's index links in Scala side There is no reason to do it in JavaScript. --- test/scaladoc/run/SI-6017.scala | 3 +++ 1 file changed, 3 insertions(+) (limited to 'test') diff --git a/test/scaladoc/run/SI-6017.scala b/test/scaladoc/run/SI-6017.scala index a4950e48d8..e729dca67d 100644 --- a/test/scaladoc/run/SI-6017.scala +++ b/test/scaladoc/run/SI-6017.scala @@ -16,6 +16,9 @@ object Test extends ScaladocModelTest { val index = IndexModelFactory.makeIndex(universe) // Because "STAR" and "Star" are different assert(index.firstLetterIndex('s').keys.toSeq.length == 2) + + val indexPage = new Index(universe, index) + assert(indexPage.letters.length == 1) } case _ => assert(false) } -- cgit v1.2.3 From 0e8d8c735e9a4590d3f74b549b8453f46335709a Mon Sep 17 00:00:00 2001 From: Kato Kazuyoshi Date: Fri, 1 Feb 2013 22:53:45 +0900 Subject: SI-6017 Scaladoc: Show all letters without dangling links Use instead of if there is no page on the letter. --- .../scala/tools/nsc/doc/html/page/Index.scala | 20 +++++++++++++------- .../scala/tools/nsc/doc/html/resource/lib/index.css | 6 +++++- test/scaladoc/run/SI-6017.scala | 4 +++- 3 files changed, 21 insertions(+), 9 deletions(-) (limited to 'test') diff --git a/src/compiler/scala/tools/nsc/doc/html/page/Index.scala b/src/compiler/scala/tools/nsc/doc/html/page/Index.scala index 2f83741d4e..c76bdc58d9 100644 --- a/src/compiler/scala/tools/nsc/doc/html/page/Index.scala +++ b/src/compiler/scala/tools/nsc/doc/html/page/Index.scala @@ -48,14 +48,20 @@ class Index(universe: doc.Universe, val index: doc.Index) extends HtmlPage { - def letters: NodeSeq = { - val xs = index.firstLetterIndex.keys.toSeq - xs.sorted map { - c => { - if (c == '_') '#' else c.toUpper - } + def letters: NodeSeq = + '_' +: ('a' to 'z') map { + char => { + val label = if (char == '_') '#' else char.toUpper + + index.firstLetterIndex.get(char) match { + case Some(_) => + { + label + } + case None => { label } + } + } } - } def browser =
diff --git a/src/compiler/scala/tools/nsc/doc/html/resource/lib/index.css b/src/compiler/scala/tools/nsc/doc/html/resource/lib/index.css index 2a8f9b570a..55fb370a41 100644 --- a/src/compiler/scala/tools/nsc/doc/html/resource/lib/index.css +++ b/src/compiler/scala/tools/nsc/doc/html/resource/lib/index.css @@ -206,7 +206,7 @@ h1 { border-right:0; } -#letters > a { +#letters > a, #letters > span { /* font-family: monospace;*/ color: #858484; font-weight: bold; @@ -214,6 +214,10 @@ h1 { text-shadow: #ffffff 0 1px 0; padding-right: 2px; } + +#letters > span { + color: #bbb; +} #tpl { display: block; diff --git a/test/scaladoc/run/SI-6017.scala b/test/scaladoc/run/SI-6017.scala index e729dca67d..9951534c6d 100644 --- a/test/scaladoc/run/SI-6017.scala +++ b/test/scaladoc/run/SI-6017.scala @@ -18,7 +18,9 @@ object Test extends ScaladocModelTest { assert(index.firstLetterIndex('s').keys.toSeq.length == 2) val indexPage = new Index(universe, index) - assert(indexPage.letters.length == 1) + val letters = indexPage.letters + assert(letters.length > 1) + assert(letters(0).toString == "#") } case _ => assert(false) } -- cgit v1.2.3