Skip to content

Commit

Permalink
auto merge of rust-lang#10421 : adridu59/rust/patch-www, r=alexcrichton
Browse files Browse the repository at this point in the history
* Closes rust-lang#10330
* Improves on rust-lang#9873
* Adds favicon for tutorial files
  • Loading branch information
bors committed Nov 13, 2013
2 parents 2b2a89d + 3d57b24 commit 49c6ae1
Show file tree
Hide file tree
Showing 9 changed files with 86 additions and 124 deletions.
1 change: 1 addition & 0 deletions doc/favicon.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<link rel="shortcut icon" href="http://www.rust-lang.org/favicon.ico" />
7 changes: 6 additions & 1 deletion doc/manual.inc
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,9 @@
display: block;
padding-left: 2em;
}
</style>
#influences blockquote p:last-child {
display: block;
line-height: 1.428571429;
color: #999999;
}
</style>
13 changes: 7 additions & 6 deletions doc/rust.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright 2013 The Rust Project Developers. See the COPYRIGHT
* file at the top-level directory of this distribution and at
* http://rust-lang.org/COPYRIGHT.
* With elements taken from Bootstrap v3.0.0 (Apache v2.0 licensed).
* With elements taken from Bootstrap v3.0.2 (MIT licensed).
*
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
* http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
Expand Down Expand Up @@ -93,6 +93,7 @@ p {
a {
text-decoration: none;
color: #428BCA;
background: transparent;
}
a:hover, a:focus {
color: #2A6496;
Expand All @@ -114,7 +115,7 @@ h5 a:link, h5 a:visited {color: black;}
/* Code
========================================================================== */
pre, code {
font-family: Monaco, Menlo, Consolas, "Courier New", monospace;
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
border-radius: 4px;
}
pre {
Expand All @@ -141,7 +142,7 @@ pre code {
color: inherit;
white-space: pre-wrap;
background-color: transparent;
border: 0;
border-radius: 0;
}

/* Code highlighting */
Expand All @@ -158,7 +159,7 @@ pre code {
.cm-s-default span.cm-string {color: #a11;}
.cm-s-default span.cm-string-2 {color: #f50;}
.cm-s-default span.cm-meta {color: #555;}
.cm-s-default span.cm-error {color: #f00;}
/*.cm-s-default span.cm-error {color: #f00;}*/
.cm-s-default span.cm-qualifier {color: #555;}
.cm-s-default span.cm-builtin {color: #30a;}
.cm-s-default span.cm-bracket {color: #cc7;}
Expand Down Expand Up @@ -187,7 +188,7 @@ pre code {
}
#versioninfo a.hash {
color: gray;
font-size: 60%;
font-size: 70%;
}

blockquote {
Expand Down Expand Up @@ -303,4 +304,4 @@ hr {
table td, table th {
background-color: #fff !important;
}
}
}
4 changes: 2 additions & 2 deletions doc/tutorial-macros.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,10 @@ solves the problem.

# Macro argument pattern matching

Now consider code like the following:

## Motivation

Now consider code like the following:

~~~~
# enum t1 { good_1(t2, uint), bad_1 };
# pub struct t2 { body: t3 }
Expand Down
9 changes: 4 additions & 5 deletions doc/tutorial-rustpkg.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ $ rustc main.rs
main.rs:1:0: 1:17 error: can't find crate for `hello`
main.rs:1 extern mod hello;
^~~~~~~~~~~~~~~~~
~~~~

This makes sense, as we haven't gotten it from anywhere yet! Luckily for us,
Expand Down Expand Up @@ -216,7 +215,7 @@ a function that can be sensibly tested:
#[license = "MIT"];
pub fn is_even(i: uint) -> bool {
i % 2 == 0
i % 2 == 0
}
~~~

Expand All @@ -230,9 +229,9 @@ use hello::is_even;
#[test]
fn test_is_even() {
assert!(is_even(0));
assert!(!is_even(1));
assert!(is_even(2));
assert!(is_even(0));
assert!(!is_even(1));
assert!(is_even(2));
}
~~~

Expand Down
4 changes: 2 additions & 2 deletions doc/tutorial-tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ an environment that it carries across tasks.
let child_task_number = generate_task_number();
do spawn {
// Capture it in the remote task
println!("I am child number {}", child_task_number);
// Capture it in the remote task
println!("I am child number {}", child_task_number);
}
~~~

Expand Down
16 changes: 8 additions & 8 deletions doc/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ confusing numbers that correspond to different units.
We've already seen several function definitions. Like all other static
declarations, such as `type`, functions can be declared both at the
top level and inside other functions (or in modules, which we'll come
back to [later](#modules-and-crates)). The `fn` keyword introduces a
back to [later](#crates-and-the-module-system)). The `fn` keyword introduces a
function. A function has an argument list, which is a parenthesized
list of `expr: type` pairs separated by commas. An arrow `->`
separates the argument list and the function's return type.
Expand Down Expand Up @@ -2711,10 +2711,10 @@ extend with the `-L` switch).
However, Rust also ships with rustpkg, a package manager that is able to automatically download and build
libraries if you use it for building your crate. How it works is explained [here][rustpkg],
but for this tutorial it's only important to know that you can optionally annotate an
`extern mod` statement with an package id that rustpkg can use to identify it:
`extern mod` statement with a package id that rustpkg can use to identify it:

~~~ {.ignore}
extern mod rust = "github.com/mozilla/rust"; // pretend Rust is an simple library
extern mod rust = "github.com/mozilla/rust"; // pretend Rust is a simple library
~~~

[rustpkg]: rustpkg.html
Expand All @@ -2730,7 +2730,7 @@ the link name and the version. It also hashes the filename and the symbols in a
based on the link metadata, allowing you to use two different versions of the same library in a crate
without conflict.

Therefor, if you plan to compile your crate as a library, you should annotate it with that information:
Therefore, if you plan to compile your crate as a library, you should annotate it with that information:

~~~~
// lib.rs
Expand All @@ -2746,8 +2746,8 @@ Therefor, if you plan to compile your crate as a library, you should annotate it
You can also in turn require in a `extern mod` statement that certain link metadata items match some criteria.
For that, Rust currently parses a comma-separated list of name/value pairs that appear after
it, and ensures that they match the attributes provided in the `link` attribute of a crate file.
This enables you to, eg, pick a a crate based on it's version number, or to link an library under an
different name. For example, this two mod statements would both accept and select the crate define above:
This enables you to, e.g., pick a crate based on its version number, or link a library under a
different name. For example, these two `mod` statements would both accept and select the crate define above:

~~~~ {.xfail-test}
extern mod farm(vers = "2.5");
Expand Down Expand Up @@ -2836,14 +2836,14 @@ This allows you to use common types and functions like `Option<T>` or `println`
without needing to import them. And if you need something from `std` that's not in the prelude,
you just have to import it with an `use` statement.

For example, it re-exports `println` which is defined in `std::io::println`:
For example, it re-exports `println` which is defined in `std::io::stdio::println`:

~~~
use puts = std::io::stdio::println;
fn main() {
println("println is imported per default.");
puts("Doesn't hinder you from importing it under an different name yourself.");
puts("Doesn't hinder you from importing it under a different name yourself.");
::std::io::stdio::println("Or from not using the automatic import.");
}
~~~
Expand Down
Loading

0 comments on commit 49c6ae1

Please sign in to comment.