Permalink
Browse files

SI-6017 Scaladoc: Show all letters without dangling links

Use <span> instead of <a href="..."> if there is no page on the letter.
  • Loading branch information...
1 parent 3f0bce9 commit 0e8d8c735e9a4590d3f74b549b8453f46335709a @kzys kzys committed Feb 1, 2013
View
20 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 {
</div>
</body>
- def letters: NodeSeq = {
- val xs = index.firstLetterIndex.keys.toSeq
- xs.sorted map {
- c => <a target="template" href={ "index/index-" + c + ".html" }>{
- if (c == '_') '#' else c.toUpper
- }</a>
+ def letters: NodeSeq =
+ '_' +: ('a' to 'z') map {
+ char => {
+ val label = if (char == '_') '#' else char.toUpper
+
+ index.firstLetterIndex.get(char) match {
+ case Some(_) =>
+ <a target="template" href={ "index/index-" + char + ".html" }>{
+ label
+ }</a>
+ case None => <span>{ label }</span>
+ }
+ }
}
- }
def browser =
<div id="browser" class="ui-layout-west">
View
6 src/compiler/scala/tools/nsc/doc/html/resource/lib/index.css
@@ -206,14 +206,18 @@ h1 {
border-right:0;
}
-#letters > a {
+#letters > a, #letters > span {
/* font-family: monospace;*/
color: #858484;
font-weight: bold;
font-size: 8pt;
text-shadow: #ffffff 0 1px 0;
padding-right: 2px;
}
+
+#letters > span {
+ color: #bbb;
+}
#tpl {
display: block;
View
4 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 == "<span>#</span>")
}
case _ => assert(false)
}

0 comments on commit 0e8d8c7

Please sign in to comment.