Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

SI-6017 Generate Scaladoc's index links in Scala side

There is no reason to do it in JavaScript.
  • Loading branch information...
commit 3f0bce95fffcea60b3cbf8bc9e0c9a410f732cde 1 parent d4b46f6
Kato Kazuyoshi kzys authored
14 src/compiler/scala/tools/nsc/doc/html/page/Index.scala
View
@@ -48,10 +48,22 @@ 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 browser =
<div id="browser" class="ui-layout-west">
<div class="ui-west-center">
- <div id="filter"></div>
+ <div id="filter">
+ <div id="textfilter"></div>
+ <div id="letters">{ letters }</div>
+ </div>
<div class="pack" id="tpl">{
def packageElem(pack: model.Package): NodeSeq = {
<xml:group>
19 src/compiler/scala/tools/nsc/doc/html/resource/lib/index.js
View
@@ -335,8 +335,7 @@ function keyboardScrolldownLeftPane() {
/* Configures the text filter */
function configureTextFilter() {
scheduler.add("init", function() {
- $("#filter").append("<div id='textfilter'><span class='pre'/><span class='input'><input id='index-input' type='text' accesskey='/'/></span><span class='post'/></div>");
- printAlphabet();
+ $("#textfilter").append("<span class='pre'/><span class='input'><input id='index-input' type='text' accesskey='/'/></span><span class='post'/>");
var input = $("#textfilter input");
resizeFilterBlock();
input.bind('keyup', function(event) {
@@ -532,19 +531,3 @@ function kindFilterSync() {
function resizeFilterBlock() {
$("#tpl").css("top", $("#filter").outerHeight(true));
}
-
-function printAlphabet() {
- var html = '<a target="template" href="index/index-_.html">#</a>';
- var c;
- for (c = 'a'; c <= 'z'; c = String.fromCharCode(c.charCodeAt(0) + 1)) {
- html += [
- '<a target="template" href="index/index-',
- c,
- '.html">',
- c.toUpperCase(),
- '</a>'
- ].join('');
- }
- $("#filter").append('<div id="letters">' + html + '</div>');
-}
-
3  test/scaladoc/run/SI-6017.scala
View
@@ -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)
}
Please sign in to comment.
Something went wrong with that request. Please try again.