Skip to content

Commit b726731

Browse files
Merge pull request #640 from jsuarezb/tutorial-pagination
Add pagination to Style guide and generalize pager
2 parents 9118ecb + 24164f2 commit b726731

Some content is hidden

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

49 files changed

+164
-136
lines changed

_includes/pager.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<nav>
2+
<ul class="pager">
3+
{% if page.previous-page %}
4+
<li class="previous"><a href="{{ page.previous-page }}.html""><span aria-hidden="true">&larr;</span> Previous</a></li>
5+
{% endif %}
6+
{% if page.next-page %}
7+
<li class="next"><a href="{{ page.next-page }}.html">Next <span aria-hidden="true">&rarr;</span></a></li>
8+
{% endif %}
9+
</ul>
10+
</nav>

_includes/tutorial-pager.txt

Lines changed: 0 additions & 10 deletions
This file was deleted.

_layouts/overview-large.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737

3838
<div class="span10">
3939
{{ content }}
40+
{% include pager.txt %}
4041
{% if page.disqus == true %}{% include disqus.txt %}{% endif %}
4142
</div>
4243

_layouts/overview.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@
4343
{{ content }}
4444
{% if page.disqus == true %}{% include disqus.txt %}{% endif %}
4545
</div>
46-
46+
4747
<div class="span6">
4848
{% include toc.txt %}
4949
</div>
50-
51-
50+
51+
5252
</div>
5353
</div>
5454

55-
{% include footer.txt %}
55+
{% include footer.txt %}

_layouts/tutorial.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,19 @@
3434
</ul>
3535
{% endif %}
3636
</div>
37-
37+
3838
<div class="span10">
3939
{{ content }}
40-
{% include tutorial-pager.txt %}
40+
{% include pager.txt %}
4141
{% if page.disqus == true %}{% include disqus.txt %}{% endif %}
4242
</div>
43-
43+
4444
<div class="span6">
4545
{% include tutorial-toc.txt %}
4646
</div>
47-
47+
4848
</div>
4949
</div>
5050
<div class="push"></div>
5151
</div>
52-
{% include footer.txt %}
52+
{% include footer.txt %}

es/tutorials/tour/singleton-objects.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ disqus: true
77
tutorial: scala-tour
88
num: 12
99
language: es
10-
tutorial-next: xml-processing
11-
tutorial-previous: pattern-matching
10+
next-page: xml-processing
11+
previous-page: pattern-matching
1212
---
1313

1414
Métodos y valores que no están asociados con instancias individuales de una [clase](classes.html) se denominan *objetos singleton* y se denotan con la palabra reservada `object` en vez de `class`.

style/control-structures.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ title: Control Structures
44

55
partof: style-guide
66
num: 7
7+
8+
previous-page: files
9+
next-page: method-invocation
710
---
811

912
All control structures should be written with a space following the
@@ -13,7 +16,7 @@ defining keyword:
1316
if (foo) bar else baz
1417
for (i <- 0 to 10) { ... }
1518
while (true) { println("Hello, World!") }
16-
19+
1720
// wrong!
1821
if(foo) bar else baz
1922
for(i <- 0 to 10) { ... }
@@ -37,7 +40,7 @@ Remember the following guidelines:
3740
only a single line.
3841
- `case` - Always omit braces in case clauses.
3942

40-
<!-- necessary to separate the following example from the above bullet list -->
43+
<!-- necessary to separate the following example from the above bullet list -->
4144

4245
val news = if (foo)
4346
goodNews()
@@ -60,7 +63,7 @@ one generator (usually, more than one `<-` symbol). In such cases, there
6063
are two alternative syntaxes which may be used:
6164

6265
// wrong!
63-
for (x <- board.rows; y <- board.files)
66+
for (x <- board.rows; y <- board.files)
6467
yield (x, y)
6568

6669
// right!

style/declarations.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ layout: overview-large
33
title: Declarations
44

55
partof: style-guide
6-
num: 6
6+
num: 9
7+
8+
previous-page: method-invocation
9+
next-page: scaladoc
710
---
811

912
## Classes
@@ -37,7 +40,7 @@ constructor arguments and extensions:
3740
birthdate: Date,
3841
astrologicalSign: String,
3942
shoeSize: Int,
40-
favoriteColor: java.awt.Color)
43+
favoriteColor: java.awt.Color)
4144
extends Entity
4245
with Logging
4346
with Identifiable
@@ -114,14 +117,14 @@ applicable):
114117
4. Final modifier (`final`)
115118
5. `def`
116119

117-
<!-- necessary to separate the following example from the above bullet list -->
120+
<!-- necessary to separate the following example from the above bullet list -->
118121

119122
@Transaction
120123
@throws(classOf[IOException])
121-
override protected final def foo() {
124+
override protected final def foo() {
122125
...
123126
}
124-
127+
125128
#### Body
126129

127130
When a method body comprises a single expression which is less than 30
@@ -186,7 +189,7 @@ There are three main reasons you should do this:
186189
structures":
187190

188191
def unless(exp: Boolean)(code: => Unit): Unit = if (!exp) code
189-
unless(x < 5) {
192+
unless(x < 5) {
190193
println("x was not less than five")
191194
}
192195

@@ -217,7 +220,7 @@ open-paren of the parameter lists, one list per line (i.e. if you can't
217220
put them all on one line, put one each per line):
218221

219222
protected def forResource(resourceInfo: Any)
220-
(f: (JsonNode) => Any)
223+
(f: (JsonNode) => Any)
221224
(implicit urlCreator: URLCreator, configurer: OAuthConfiguration): Any = {
222225
...
223226
}
@@ -275,20 +278,20 @@ function value.
275278
When styles (1) and (4) are used exclusively, it becomes very easy to
276279
distinguish places in the source code where function values are used.
277280
Both styles make use of parentheses, since they look clean on a single line.
278-
281+
279282
### Spacing
280283

281284
There should be no space between parentheses and the code they contain.
282-
Curly braces should be separated from the code within them by a one-space gap,
285+
Curly braces should be separated from the code within them by a one-space gap,
283286
to give the visually busy braces "breathing room".
284287

285288
### Multi-Expression Functions
286289

287290
Most function values are less trivial than the examples given above.
288291
Many contain more than one expression. In such cases, it is often more
289292
readable to split the function value across multiple lines. When this
290-
happens, only style (1) should be used, substituting braces for parentheses.
291-
Style (4) becomes extremely difficult to follow when enclosed in large amounts
293+
happens, only style (1) should be used, substituting braces for parentheses.
294+
Style (4) becomes extremely difficult to follow when enclosed in large amounts
292295
of code. The declaration itself should loosely follow the declaration style for
293296
methods, with the opening brace on the same line as the assignment or
294297
invocation, while the closing brace is on its own line immediately

style/files.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ layout: overview-large
33
title: Files
44

55
partof: style-guide
6-
num: 9
6+
num: 6
7+
8+
previous-page: nested-blocks
9+
next-page: control-structures
710
---
811

912
As a rule, files should contain a *single* logical compilation unit. By
@@ -63,4 +66,3 @@ declarations. These filenames may be based upon a significant type which
6366
they contain (e.g. `option.scala` for the example above), or may be
6467
descriptive of the logical property shared by all units within (e.g.
6568
`ast.scala`).
66-

style/indentation.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ title: Indentation
44

55
partof: style-guide
66
num: 2
7+
8+
previous-page: overview
9+
next-page: naming-conventions
710
---
811

912
Indentation should follow the "2-space convention". Thus, instead of

style/method-invocation.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ title: Method Invocation
44

55
partof: style-guide
66
num: 8
7+
8+
previous-page: control-structures
9+
next-page: declarations
710
---
811

912
Generally speaking, method invocation in Scala follows Java conventions.
@@ -62,14 +65,14 @@ Scala allows methods of arity-0 to be invoked using suffix notation:
6265
names toList // Unsafe, don't use!
6366

6467
This style is unsafe, and should not be used. Since semicolons are
65-
optional, the compiler will attempt to treat it as an infix method
68+
optional, the compiler will attempt to treat it as an infix method
6669
if it can, potentially taking a term from the next line.
6770

6871
names toList
6972
val answer = 42 // will not compile!
7073

71-
This may result in unexpected compile errors at best, and happily
72-
compiled faulty code at worst. Although the syntax is used by some
74+
This may result in unexpected compile errors at best, and happily
75+
compiled faulty code at worst. Although the syntax is used by some
7376
DSLs, it should be considered deprecated, and avoided.
7477

7578
As of Scala 2.10, using suffix operator notation will result in a compiler warning.
@@ -152,4 +155,3 @@ Finally, the use of the `/:` and `:\` should be avoided in preference to
152155
the more explicit `foldLeft` and `foldRight` method of `Iterator`. The
153156
right-associativity of the `/:` can lead to extremely confusing code, at
154157
the benefit of saving a few characters.
155-

style/naming-conventions.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ title: Naming Conventions
44

55
partof: style-guide
66
num: 3
7+
8+
previous-page: indentation
9+
next-page: types
710
---
811

912
Generally speaking, Scala uses "camel case" naming. That is,

style/nested-blocks.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ title: Nested Blocks
44

55
partof: style-guide
66
num: 5
7+
8+
previous-page: types
9+
next-page: files
710
---
811

912
## Curly Braces
@@ -31,13 +34,13 @@ lines as their content (Lisp-style):
3134
(this + is a very ++ long *
3235
expression)
3336

34-
Parentheses also serve to disable semicolon inference, and so allow the developer
37+
Parentheses also serve to disable semicolon inference, and so allow the developer
3538
to start lines with operators, which some prefer:
36-
39+
3740
( someCondition
3841
|| someOtherCondition
3942
|| thirdCondition
4043
)
41-
42-
A trailing parenthesis on the following line is acceptable in this case, for
44+
45+
A trailing parenthesis on the following line is acceptable in this case, for
4346
aesthetic reasons.

style/overview.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
---
22
layout: overview-large
33
title: Overview
4+
45
partof: style-guide
56
num: 1
67
outof: 10
8+
9+
next-page: indentation
710
---
811

9-
Please see the [table of contents of the style guide]({{ site.baseurl }}/style) for an outline-style overview.
12+
Please see the [table of contents of the style guide]({{ site.baseurl }}/style) for an outline-style overview.

0 commit comments

Comments
 (0)