Skip to content

Commit 44840f5

Browse files
committed
Overviews almost overhauled
1 parent ad80b62 commit 44840f5

File tree

124 files changed

+1549
-2602
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+1549
-2602
lines changed

_config.yml

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ keywords:
1818
collections:
1919
style:
2020
output: true
21+
overviews:
22+
output: true
2123
books:
2224
output: false
2325

_data/overviews.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,15 @@
6868
overviews:
6969
- title: Scaladoc
7070
icon: book
71-
url: "collections/introduction.html"
71+
url: "scaladoc/overview.html"
7272
description: "Scala's API documentation generation tool."
7373
subdocs:
7474
- title: Overview
7575
url: "scaladoc/overview.html"
76-
- title: Using Scaladoc Effectively
77-
url: "scaladoc/interface.html"
78-
- title: Authoring Scaladoc
76+
- title: Scaladoc for Library Authors
7977
url: "scaladoc/for-library-authors.html"
78+
- title: Using the Scaladoc Interface
79+
url: "scaladoc/interface.html"
8080
- title: Scala REPL
8181
icon: terminal
8282
url: "repl/overview.html"
@@ -155,7 +155,7 @@
155155
- title: Macros
156156
by: Eugene Burmako
157157
icon: magic
158-
url: "#!"
158+
url: "macros/usecases.html"
159159
description: "Scala's metaprogramming framework."
160160
label-text: experimental
161161
subdocs:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<div class="content-nav">
2+
<div class="inner-box sidebar-toc-wrapper" style="">
3+
<h5 class="contents">Contents</h5>
4+
<div class="inner-toc" id="sidebar-toc">
5+
{% if page.includeCollectionTOC or layout.includeCollectionTOC %}
6+
<ul>
7+
{% assign sorted = site.overviews | sort: 'num' %}
8+
{% for pg in sorted %}
9+
{% if pg.num and (page.partof == pg.partof) %}
10+
<li><a href="{{ site.baseurl }}{{ pg.url }}">{{ pg.title }}</a></li>
11+
{% if pg.num == page.num %}<div id="toc"></div>{% endif %}
12+
{% endif %}
13+
{% endfor %}
14+
</ul>
15+
{% endif %}
16+
{% if page.languages %}
17+
<ul id="available-languages" style="display: none;">
18+
<li><a href="{{ page.url }}">English</a></li>
19+
{% for l in page.languages %}
20+
{% capture intermediate %}{{ page.url | remove_first: l }}{% endcapture %}
21+
{% capture rootTutorialURL %}{{ intermediate | remove_first: '/' }}{% endcapture %}
22+
{% assign lang = site.data.languages[l] %}
23+
<li><a href="{{ site.baseurl }}/{{ l }}/{{ rootTutorialURL }}" class="lang">{{ lang.name }}</a></li>
24+
{% endfor %}
25+
</ul>
26+
{% endif %}
27+
</div>
28+
<hr>
29+
<div class="help-us"><a href="/contribute/documentation/#updating-scala-langorg">Problem with this page?<br> Please help us fix it!</a></div>
30+
</div>
31+
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<div class="content-nav">
2+
<div class="inner-box sidebar-toc-wrapper" style="">
3+
<h5 class="contents">Contents</h5>
4+
<div class="inner-toc" id="sidebar-toc">
5+
<div id="toc"></div>
6+
{% if page.languages %}
7+
<ul id="available-languages" style="display: none;">
8+
<li><a href="{{ page.url }}">English</a></li>
9+
{% for l in page.languages %}
10+
{% capture intermediate %}{{ page.url | remove_first: l }}{% endcapture %}
11+
{% capture rootTutorialURL %}{{ intermediate | remove_first: '/' }}{% endcapture %}
12+
{% assign lang = site.data.languages[l] %}
13+
<li><a href="{{ site.baseurl }}/{{ l }}/{{ rootTutorialURL }}" class="lang">{{ lang.name }}</a></li>
14+
{% endfor %}
15+
</ul>
16+
{% endif %}
17+
</div>
18+
<hr>
19+
<div class="help-us"><a href="/contribute/documentation/#updating-scala-langorg">Problem with this page?<br> Please help us fix it!</a></div>
20+
</div>
21+
</div>

_includes/sidebar-toc-style.html

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{% if page.includeTOC or layout.includeTOC %}
2+
{% if page.includeTOC != false %}
3+
<!-- Don't include TOC -->
4+
5+
{% for pg in site.posts %}
6+
{% if pg.overview == page.overview and pg.languages %}
7+
{% assign languages = pg.languages %}
8+
{% endif %}
9+
{% endfor %}
10+
11+
{% for pg in site.pages %}
12+
{% if pg.overview == page.overview and pg.languages %}
13+
{% assign languages = pg.languages %}
14+
{% endif %}
15+
{% endfor %}
16+
17+
{% if page.language %}
18+
{% capture intermediate %}{{ page.url | remove_first: page.language }}{% endcapture %}
19+
{% capture rootTutorialURL %}{{ intermediate | remove_first: '/' }}{% endcapture %}
20+
{% else %}
21+
{% assign rootTutorialURL = page.url %}
22+
{% endif %}
23+
24+
<div class="content-nav">
25+
<div class="inner-box sidebar-toc-wrapper" style="">
26+
27+
<!-- <li><a href="{{ site.baseurl }}{{ rootTutorialURL }}" class="lang">English</a></li>
28+
{% for l in languages %}
29+
{% assign lang = site.data.languages[l] %}
30+
<li><a href="{{ site.baseurl }}/{{ l }}{{ rootTutorialURL }}" class="lang">{{lang.name}}</a></li>
31+
{% endfor %} -->
32+
33+
<h5 class="contents">Contents</h5>
34+
<div class="inner-toc" id="sidebar-toc">
35+
{% if page.includeCollectionTOC or layout.includeCollectionTOC %}
36+
{% for collection in site.collections %}
37+
{% assign name = collection.label %}
38+
{% if page.partof == name %}
39+
{% assign sorted = (site.[name]| sort: 'num') %}
40+
<ul>
41+
{% for pg in sorted %}
42+
{% if pg.num %}
43+
<li><a href="{{ site.baseurl }}{{ pg.url }}">{{ pg.title }}</a></li>
44+
{% if pg.num == page.num %}
45+
<div id="toc"></div>
46+
{% endif %}
47+
{% endif %}
48+
{% endfor %}
49+
</ul>
50+
{% endif %}
51+
{% endfor %}
52+
{% endif %}
53+
</div>
54+
<hr>
55+
<div class="help-us"><a href="/contribute/documentation/#updating-scala-langorg">Problem with this page?<br> Please help us fix it!</a></div>
56+
</div>
57+
</div>
58+
{% endif %}
59+
{% endif %}

_includes/sidebar-toc.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@
2424
<div class="content-nav">
2525
<div class="inner-box sidebar-toc-wrapper" style="">
2626

27-
<li><a href="{{ site.baseurl }}{{ rootTutorialURL }}" class="lang">English</a></li>
27+
<!-- <li><a href="{{ site.baseurl }}{{ rootTutorialURL }}" class="lang">English</a></li>
2828
{% for l in languages %}
2929
{% assign lang = site.data.languages[l] %}
3030
<li><a href="{{ site.baseurl }}/{{ l }}{{ rootTutorialURL }}" class="lang">{{lang.name}}</a></li>
31-
{% endfor %}
31+
{% endfor %} -->
3232

33-
<h5>Contents</h5>
33+
<h5 class="contents">Contents</h5>
3434
<div class="inner-toc" id="sidebar-toc">
3535
{% if page.includeCollectionTOC or layout.includeCollectionTOC %}
3636
{% for collection in site.collections %}
@@ -40,7 +40,7 @@ <h5>Contents</h5>
4040
<ul>
4141
{% for pg in sorted %}
4242
{% if pg.num %}
43-
<li><a {% if pg.num == page.num %}class="active"{% endif %} href="{{ site.baseurl }}{{ pg.url }}">{{ pg.title }}</a></li>
43+
<li><a href="{{ site.baseurl }}{{ pg.url }}">{{ pg.title }}</a></li>
4444
{% if pg.num == page.num %}
4545
<div id="toc"></div>
4646
{% endif %}

_layouts/blog-list.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
2-
layout: inner-page-parent-searchbar
2+
layout: inner-page-parent-dropdown
33
---
44

55
{% if page.category %}
66
{% include blog-list.html category=page.category %}
77
{% else %}
88
{% include blog-list.html %}
9-
{% endif %}
9+
{% endif %}
+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{% include headertop.html %}
2+
{% include headerbottom.html %}
3+
4+
<div class="navigation-fade-screen"></div>
5+
6+
{% include navbar-inner.html %}
7+
8+
<main id="inner-main">
9+
10+
<!-- Title -->
11+
<section class="title-page">
12+
<div class="wrap">
13+
<div class="content-title-documentation">
14+
<div class="titles">
15+
{% if page.overview-name %}
16+
<div class="supertitle">{{ page.overview-name }}</div>
17+
{% else %}
18+
<div class="supertitle">&nbsp;</div>
19+
{% endif %}
20+
<h1>{{ page.title }}</h1>
21+
</div>
22+
<div class="language-dropdown">
23+
<div id="dd" class="wrapper-dropdown" tabindex="1">
24+
<span>Language</span>
25+
<ul class="dropdown"></ul>
26+
</div>
27+
</div>
28+
</div>
29+
</section>
30+
31+
{% comment %}Specific content from child layouts{% endcomment %}
32+
{{content}}
33+
34+
</main>
35+
36+
{% include footer.html %}

_layouts/inner-page-parent-searchbar.html

-32
This file was deleted.

_layouts/multipage-overview.html

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
layout: inner-page-parent-dropdown
3+
includeTOC: true
4+
includeCollectionTOC: true
5+
---
6+
7+
<section class="content">
8+
<div class="wrap">
9+
<div class="content-primary documentation">
10+
<div class="inner-box">
11+
{{content}}
12+
</div>
13+
</div>
14+
15+
<!-- TOC -->
16+
{% include sidebar-toc-multipage-overview.html %}
17+
</div>
18+
</section>
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
---
2-
layout: inner-page-parent-searchbar
2+
layout: inner-page-parent-dropdown
33
includeTOC: true
44
---
55

66
<section class="content">
77
<div class="wrap">
8-
<div class="content-primary">
8+
<div class="content-primary documentation">
99
<div class="inner-box">
1010
{{content}}
1111
</div>
1212
</div>
1313

1414
<!-- TOC -->
15-
{% include sidebar-toc.html %}
15+
{% include sidebar-toc-singlepage-overview.html %}
1616
</div>
1717
</section>

_layouts/style-guide.html

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
layout: inner-page-parent-dropdown
3+
includeCollectionTOC: true
4+
includeTOC: true
5+
---
6+
7+
<section class="content">
8+
<div class="wrap">
9+
<div class="content-primary documentation">
10+
<div class="inner-box">
11+
{{content}}
12+
</div>
13+
</div>
14+
15+
<!-- TOC -->
16+
{% include sidebar-toc-style.html %}
17+
</div>
18+
</section>

overviews/collections/arrays.md renamed to _overviews/collections/arrays.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
---
2-
layout: overview
2+
layout: multipage-overview
33
title: Arrays
44

55
discourse: true
66

77
partof: collections
8+
overview-name: Collections
9+
810
num: 10
11+
912
languages: [ja, zh-cn]
13+
permalink: /overviews/collections/:title.html
1014
---
1115

1216
[Array](http://www.scala-lang.org/api/{{ site.scala-version }}/scala/Array.html) is a special kind of collection in Scala. On the one hand, Scala arrays correspond one-to-one to Java arrays. That is, a Scala array `Array[Int]` is represented as a Java `int[]`, an `Array[Double]` is represented as a Java `double[]` and a `Array[String]` is represented as a Java `String[]`. But at the same time, Scala arrays offer much more than their Java analogues. First, Scala arrays can be _generic_. That is, you can have an `Array[T]`, where `T` is a type parameter or abstract type. Second, Scala arrays are compatible with Scala sequences - you can pass an `Array[T]` where a `Seq[T]` is required. Finally, Scala arrays also support all sequence operations. Here's an example of this in action:
@@ -79,7 +83,7 @@ The `evenElems` method returns a new array that consist of all elements of the a
7983
What's required here is that you help the compiler out by providing some runtime hint what the actual type parameter of `evenElems` is. This runtime hint takes the form of a class manifest of type `scala.reflect.ClassTag`. A class manifest is a type descriptor object which describes what the top-level class of a type is. Alternatively to class manifests there are also full manifests of type `scala.reflect.Manifest`, which describe all aspects of a type. But for array creation, only class manifests are needed.
8084

8185
The Scala compiler will construct class manifests automatically if you instruct it to do so. "Instructing" means that you demand a class manifest as an implicit parameter, like this:
82-
86+
8387
def evenElems[T](xs: Vector[T])(implicit m: ClassTag[T]): Array[T] = ...
8488

8589
Using an alternative and shorter syntax, you can also demand that the type comes with a class manifest by using a context bound. This means following the type with a colon and the class name `ClassTag`, like this:

overviews/collections/concrete-immutable-collection-classes.md renamed to _overviews/collections/concrete-immutable-collection-classes.md

+6-24
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
---
2-
layout: overview
2+
layout: multipage-overview
33
title: Concrete Immutable Collection Classes
44

55
discourse: true
66

77
partof: collections
8+
overview-name: Collections
9+
810
num: 8
11+
912
languages: [ja, zh-cn]
13+
permalink: /overviews/collections/:title.html
1014
---
1115

1216
Scala provides many concrete immutable collection classes for you to choose from. They differ in the traits they implement (maps, sets, sequences), whether they can be infinite, and the speed of various operations. Here are some of the most common immutable collection types used in Scala.
@@ -186,29 +190,7 @@ Operations on bit sets are very fast. Testing for inclusion takes constant time.
186190
A [ListMap](http://www.scala-lang.org/api/{{ site.scala-version }}/scala/collection/immutable/ListMap.html) represents a map as a linked list of key-value pairs. In general, operations on a list map might have to iterate through the entire list. Thus, operations on a list map take time linear in the size of the map. In fact there is little usage for list maps in Scala because standard immutable maps are almost always faster. The only possible exception to this is if the map is for some reason constructed in such a way that the first elements in the list are selected much more often than the other elements.
187191

188192
scala> val map = scala.collection.immutable.ListMap(1->"one", 2->"two")
189-
map: scala.collection.immutable.ListMap[Int,java.lang.String] =
193+
map: scala.collection.immutable.ListMap[Int,java.lang.String] =
190194
Map(1 -> one, 2 -> two)
191195
scala> map(2)
192196
res30: String = "two"
193-
194-
195-
196-
197-
198-
199-
200-
201-
202-
203-
204-
205-
206-
207-
208-
209-
210-
211-
212-
213-
214-

0 commit comments

Comments
 (0)