Skip to content

Add pagination to Style guide and generalize pager #640

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions _includes/pager.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<nav>
<ul class="pager">
{% if page.previous-page %}
<li class="previous"><a href="{{ page.previous-page }}.html""><span aria-hidden="true">&larr;</span> Previous</a></li>
{% endif %}
{% if page.next-page %}
<li class="next"><a href="{{ page.next-page }}.html">Next <span aria-hidden="true">&rarr;</span></a></li>
{% endif %}
</ul>
</nav>
10 changes: 0 additions & 10 deletions _includes/tutorial-pager.txt

This file was deleted.

1 change: 1 addition & 0 deletions _layouts/overview-large.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

<div class="span10">
{{ content }}
{% include pager.txt %}
{% if page.disqus == true %}{% include disqus.txt %}{% endif %}
</div>

Expand Down
8 changes: 4 additions & 4 deletions _layouts/overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@
{{ content }}
{% if page.disqus == true %}{% include disqus.txt %}{% endif %}
</div>

<div class="span6">
{% include toc.txt %}
</div>


</div>
</div>

{% include footer.txt %}
{% include footer.txt %}
10 changes: 5 additions & 5 deletions _layouts/tutorial.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@
</ul>
{% endif %}
</div>

<div class="span10">
{{ content }}
{% include tutorial-pager.txt %}
{% include pager.txt %}
{% if page.disqus == true %}{% include disqus.txt %}{% endif %}
</div>

<div class="span6">
{% include tutorial-toc.txt %}
</div>

</div>
</div>
<div class="push"></div>
</div>
{% include footer.txt %}
{% include footer.txt %}
4 changes: 2 additions & 2 deletions es/tutorials/tour/singleton-objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ disqus: true
tutorial: scala-tour
num: 12
language: es
tutorial-next: xml-processing
tutorial-previous: pattern-matching
next-page: xml-processing
previous-page: pattern-matching
---

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`.
Expand Down
9 changes: 6 additions & 3 deletions style/control-structures.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ title: Control Structures

partof: style-guide
num: 7

previous-page: files
next-page: method-invocation
---

All control structures should be written with a space following the
Expand All @@ -13,7 +16,7 @@ defining keyword:
if (foo) bar else baz
for (i <- 0 to 10) { ... }
while (true) { println("Hello, World!") }

// wrong!
if(foo) bar else baz
for(i <- 0 to 10) { ... }
Expand All @@ -37,7 +40,7 @@ Remember the following guidelines:
only a single line.
- `case` - Always omit braces in case clauses.

<!-- necessary to separate the following example from the above bullet list -->
<!-- necessary to separate the following example from the above bullet list -->

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

// wrong!
for (x <- board.rows; y <- board.files)
for (x <- board.rows; y <- board.files)
yield (x, y)

// right!
Expand Down
25 changes: 14 additions & 11 deletions style/declarations.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ layout: overview-large
title: Declarations

partof: style-guide
num: 6
num: 9

previous-page: method-invocation
next-page: scaladoc
---

## Classes
Expand Down Expand Up @@ -37,7 +40,7 @@ constructor arguments and extensions:
birthdate: Date,
astrologicalSign: String,
shoeSize: Int,
favoriteColor: java.awt.Color)
favoriteColor: java.awt.Color)
extends Entity
with Logging
with Identifiable
Expand Down Expand Up @@ -114,14 +117,14 @@ applicable):
4. Final modifier (`final`)
5. `def`

<!-- necessary to separate the following example from the above bullet list -->
<!-- necessary to separate the following example from the above bullet list -->

@Transaction
@throws(classOf[IOException])
override protected final def foo() {
override protected final def foo() {
...
}

#### Body

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

def unless(exp: Boolean)(code: => Unit): Unit = if (!exp) code
unless(x < 5) {
unless(x < 5) {
println("x was not less than five")
}

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

protected def forResource(resourceInfo: Any)
(f: (JsonNode) => Any)
(f: (JsonNode) => Any)
(implicit urlCreator: URLCreator, configurer: OAuthConfiguration): Any = {
...
}
Expand Down Expand Up @@ -275,20 +278,20 @@ function value.
When styles (1) and (4) are used exclusively, it becomes very easy to
distinguish places in the source code where function values are used.
Both styles make use of parentheses, since they look clean on a single line.

### Spacing

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

### Multi-Expression Functions

Most function values are less trivial than the examples given above.
Many contain more than one expression. In such cases, it is often more
readable to split the function value across multiple lines. When this
happens, only style (1) should be used, substituting braces for parentheses.
Style (4) becomes extremely difficult to follow when enclosed in large amounts
happens, only style (1) should be used, substituting braces for parentheses.
Style (4) becomes extremely difficult to follow when enclosed in large amounts
of code. The declaration itself should loosely follow the declaration style for
methods, with the opening brace on the same line as the assignment or
invocation, while the closing brace is on its own line immediately
Expand Down
6 changes: 4 additions & 2 deletions style/files.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ layout: overview-large
title: Files

partof: style-guide
num: 9
num: 6

previous-page: nested-blocks
next-page: control-structures
---

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

3 changes: 3 additions & 0 deletions style/indentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ title: Indentation

partof: style-guide
num: 2

previous-page: overview
next-page: naming-conventions
---

Indentation should follow the "2-space convention". Thus, instead of
Expand Down
10 changes: 6 additions & 4 deletions style/method-invocation.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ title: Method Invocation

partof: style-guide
num: 8

previous-page: control-structures
next-page: declarations
---

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

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

names toList
val answer = 42 // will not compile!

This may result in unexpected compile errors at best, and happily
compiled faulty code at worst. Although the syntax is used by some
This may result in unexpected compile errors at best, and happily
compiled faulty code at worst. Although the syntax is used by some
DSLs, it should be considered deprecated, and avoided.

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

3 changes: 3 additions & 0 deletions style/naming-conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ title: Naming Conventions

partof: style-guide
num: 3

previous-page: indentation
next-page: types
---

Generally speaking, Scala uses "camel case" naming. That is,
Expand Down
11 changes: 7 additions & 4 deletions style/nested-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ title: Nested Blocks

partof: style-guide
num: 5

previous-page: types
next-page: files
---

## Curly Braces
Expand Down Expand Up @@ -31,13 +34,13 @@ lines as their content (Lisp-style):
(this + is a very ++ long *
expression)

Parentheses also serve to disable semicolon inference, and so allow the developer
Parentheses also serve to disable semicolon inference, and so allow the developer
to start lines with operators, which some prefer:

( someCondition
|| someOtherCondition
|| thirdCondition
)
A trailing parenthesis on the following line is acceptable in this case, for

A trailing parenthesis on the following line is acceptable in this case, for
aesthetic reasons.
5 changes: 4 additions & 1 deletion style/overview.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
---
layout: overview-large
title: Overview

partof: style-guide
num: 1
outof: 10

next-page: indentation
---

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