Skip to content
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

エディションガイドの内容を最小限のものに変更する #21

Merged
merged 7 commits into from
Nov 3, 2021
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
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ jobs:
- store_artifacts:
path: /tmp/docs.txz
destination: docs.txz
- run:
name: Testing book
command: mdbook test
# - run:
# name: Testing book
# command: mdbook test
Comment on lines +27 to +29
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mdbook test を一時的にコメントアウト。 #22 で対応予定。

# - run:
# name: Check for broken links
# command: |
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
book
docs
.DS_Store

2 changes: 1 addition & 1 deletion LICENSE-APACHE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ APPENDIX: How to apply the Apache License to your work.
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]
Copyright 2018 - 2021 The Rust Project Developers

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion LICENSE-MIT
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2018 The Rust Project Developers
Copyright (c) 2018 - 2021 The Rust Project Developers

Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
Expand Down
34 changes: 8 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This book explains the concept of "editions", major new eras in [Rust]'s
development. You can [read the book
online](https://doc.rust-lang.org/nightly/edition-guide/).

[rust]: https://www.rust-lang.org/
[Rust]: https://www.rust-lang.org/

## License

Expand All @@ -21,9 +21,9 @@ You can also build the book and read it locally if you'd like.

### Requirements

Building the book requires [mdBook] 0.2. To get it:
Building the book requires [mdBook] 0.4. To get it:

[mdbook]: https://github.com/azerupi/mdBook
[mdBook]: https://github.com/rust-lang/mdBook

```bash
$ cargo install mdbook
Expand All @@ -32,32 +32,14 @@ $ cargo install mdbook
### Building

The most straight-forward way to build and view the book locally is to use the following command:

```bash
$ mdbook serve
$ mdbook serve --open
```

This serves the book at http://localhost:3000, and rebuilds it on changes.
You can now view the book in your web browser. If you make changes to the book's source code,
you should only need to refresh your browser to see them.

_Firefox:_

```shell
$ firefox http://localhost:3000 # Linux
$ open -a "Firefox" http://localhost:3000 # OS X
$ Start-Process "firefox.exe" http://localhost:3000 # Windows (PowerShell)
$ start firefox.exe http://localhost:3000 # Windows (Cmd)
```

_Chrome:_

```shell
$ google-chrome http://localhost:3000 # Linux
$ open -a "Google Chrome" http://localhost:3000 # OS X
$ Start-Process "chrome.exe" http://localhost:3000 # Windows (PowerShell)
$ start chrome.exe http://localhost:3000 # Windows (Cmd)
```
This builds the HTML version of the book, starts a webserver at
http://localhost:3000, and opens your default web browser. It will also
automatically rebuild the book whenever the source changes, and the page
should automatically reload.

To run the tests:

Expand Down
109 changes: 108 additions & 1 deletion book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,114 @@
authors = ["The Rust Project Developers"]
multilingual = false
src = "src"
title = "The Edition Guide"
title = "エディションガイド"
language = "ja"

[build]
build-dir = "docs"

[output.html]
git-repository-url = "https://github.com/rust-lang-ja/edition-guide"
additional-css = ["theme/em-to-bold.css"]

[output.html.redirect]
"/rust-2018/edition-changes.html" = "index.html"
"/rust-2018/module-system/index.html" = "../path-changes.html"
"/rust-2018/module-system/raw-identifiers.html" = "https://doc.rust-jp.rs/rust-by-example-ja/compatibility/raw_identifiers.html"
"/rust-2018/module-system/path-clarity.html" = "../path-changes.html"
"/rust-2018/module-system/more-visibility-modifiers.html" = "https://doc.rust-lang.org/reference/visibility-and-privacy.html"
"/rust-2018/module-system/nested-imports-with-use.html" = "https://doc.rust-jp.rs/rust-by-example-ja/mod/use.html"
"/rust-2018/error-handling-and-panics/index.html" = "https://doc.rust-jp.rs/book-ja/ch09-00-error-handling.html"
"/rust-2018/error-handling-and-panics/the-question-mark-operator-for-easier-error-handling.html" = "https://doc.rust-jp.rs/book-ja/ch09-02-recoverable-errors-with-result.html"
"/rust-2018/error-handling-and-panics/question-mark-in-main-and-tests.html" = "https://doc.rust-jp.rs/rust-by-example-ja/error/result.html#using-result-in-main"
"/rust-2018/error-handling-and-panics/controlling-panics-with-std-panic.html" = "https://blog.rust-lang.org/2016/05/26/Rust-1.9.html#controlled-unwinding"
"/rust-2018/error-handling-and-panics/aborting-on-panic.html" = "https://doc.rust-jp.rs/book-ja/ch09-01-unrecoverable-errors-with-panic.html"
"/rust-2018/control-flow/index.html" = "https://doc.rust-jp.rs/rust-by-example-ja/flow_control.html"
"/rust-2018/control-flow/loops-can-break-with-a-value.html" = "https://doc.rust-jp.rs/rust-by-example-ja/flow_control/loop/return.html"
"/rust-2018/control-flow/async-await-for-easier-concurrency.html" = "https://rust-lang.github.io/async-book/"
"/rust-2018/trait-system/index.html" = "../index.html"
"/rust-2018/trait-system/impl-trait-for-returning-complex-types-with-ease.html" = "https://blog.rust-lang.org/2018/05/10/Rust-1.26.html#impl-trait"
"/rust-2018/trait-system/dyn-trait-for-trait-objects.html" = "https://blog.rust-lang.org/2018/06/21/Rust-1.27.html#dyn-trait"
"/rust-2018/trait-system/more-container-types-support-trait-objects.html" = "https://github.com/rust-lang/rfcs/blob/master/text/0982-dst-coercion.md"
"/rust-2018/trait-system/associated-constants.html" = "https://doc.rust-lang.org/reference/items/associated-items.html#associated-constants"
"/rust-2018/trait-system/no-anon-params.html" = "../trait-fn-parameters.html"
"/rust-2018/slice-patterns.html" = "https://blog.rust-lang.org/2018/05/10/Rust-1.26.html#basic-slice-patterns"
"/rust-2018/ownership-and-lifetimes/index.html" = "https://doc.rust-jp.rs/book-ja/ch04-00-understanding-ownership.html"
"/rust-2018/ownership-and-lifetimes/non-lexical-lifetimes.html" = "https://blog.rust-lang.org/2018/12/06/Rust-1.31-and-rust-2018.html#non-lexical-lifetimes"
"/rust-2018/ownership-and-lifetimes/default-match-bindings.html" = "https://blog.rust-lang.org/2018/05/10/Rust-1.26.html#nicer-match-bindings"
"/rust-2018/ownership-and-lifetimes/the-anonymous-lifetime.html" = "https://blog.rust-lang.org/2018/12/06/Rust-1.31-and-rust-2018.html#more-lifetime-elision-rules"
"/rust-2018/ownership-and-lifetimes/lifetime-elision-in-impl.html" = "https://blog.rust-lang.org/2018/12/06/Rust-1.31-and-rust-2018.html#more-lifetime-elision-rules"
"/rust-2018/ownership-and-lifetimes/inference-in-structs.html" = "https://github.com/rust-lang/rfcs/blob/master/text/2093-infer-outlives.md"
"/rust-2018/ownership-and-lifetimes/simpler-lifetimes-in-static-and-const.html" = "https://doc.rust-lang.org/reference/lifetime-elision.html#static-lifetime-elision"
"/rust-2018/data-types/index.html" = "../index.html"
"/rust-2018/data-types/field-init-shorthand.html" = "https://doc.rust-lang.org/reference/expressions/struct-expr.html#struct-field-init-shorthand"
"/rust-2018/data-types/inclusive-ranges.html" = "https://blog.rust-lang.org/2018/05/10/Rust-1.26.html#inclusive-ranges-with-"
"/rust-2018/data-types/128-bit-integers.html" = "https://blog.rust-lang.org/2018/05/10/Rust-1.26.html#128-bit-integers"
"/rust-2018/data-types/operator-equals-are-now-implementable.html" = "https://doc.rust-lang.org/std/ops/index.html"
"/rust-2018/data-types/union-for-an-unsafe-form-of-enum.html" = "https://doc.rust-lang.org/reference/items/unions.html"
"/rust-2018/data-types/choosing-alignment-with-the-repr-attribute.html" = "https://doc.rust-lang.org/reference/type-layout.html#representations"
"/rust-2018/simd-for-faster-computing.html" = "https://blog.rust-lang.org/2018/06/21/Rust-1.27.html#simd"
"/rust-2018/macros/index.html" = "https://doc.rust-jp.rs/book-ja/ch19-06-macros.html"
"/rust-2018/macros/custom-derive.html" = "https://doc.rust-jp.rs/book-ja/ch19-06-macros.html#how-to-write-a-custom-derive-macro"
"/rust-2018/macros/macro-changes.html" = "https://doc.rust-jp.rs/book-ja/ch19-06-macros.html"
"/rust-2018/macros/at-most-once.html" = "https://doc.rust-lang.org/reference/macros-by-example.html#repetitions"
"/rust-2018/the-compiler/index.html" = "../index.html"
"/rust-2018/the-compiler/improved-error-messages.html" = "https://blog.rust-lang.org/2016/09/29/Rust-1.12.html#overhauled-error-messages"
"/rust-2018/the-compiler/incremental-compilation-for-faster-compiles.html" = "https://blog.rust-lang.org/2018/02/15/Rust-1.24.html#incremental-compilation"
"/rust-2018/the-compiler/an-attribute-for-deprecation.html" = "https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-deprecated-attribute"
"/rust-2018/rustup-for-managing-rust-versions.html" = "https://rust-lang.github.io/rustup/"
"/rust-2018/cargo-and-crates-io/index.html" = "https://doc.rust-lang.org/cargo/index.html"
"/rust-2018/cargo-and-crates-io/cargo-check-for-faster-checking.html" = "https://doc.rust-lang.org/cargo/commands/cargo-check.html"
"/rust-2018/cargo-and-crates-io/cargo-install-for-easy-installation-of-tools.html" = "https://doc.rust-lang.org/cargo/commands/cargo-install.html"
"/rust-2018/cargo-and-crates-io/cargo-new-defaults-to-a-binary-project.html" = "https://blog.rust-lang.org/2018/03/29/Rust-1.25.html#cargo-features"
"/rust-2018/cargo-and-crates-io/cargo-rustc-for-passing-arbitrary-flags-to-rustc.html" = "https://doc.rust-lang.org/cargo/commands/cargo-rustc.html"
"/rust-2018/cargo-and-crates-io/cargo-workspaces-for-multi-package-projects.html" = "https://doc.rust-lang.org/cargo/reference/workspaces.html"
"/rust-2018/cargo-and-crates-io/multi-file-examples.html" = "https://doc.rust-lang.org/cargo/guide/project-layout.html"
"/rust-2018/cargo-and-crates-io/replacing-dependencies-with-patch.html" = "https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html#the-patch-section"
"/rust-2018/cargo-and-crates-io/cargo-can-use-a-local-registry-replacement.html" = "https://doc.rust-lang.org/cargo/reference/source-replacement.html"
"/rust-2018/cargo-and-crates-io/crates-io-disallows-wildcard-dependencies.html" = "https://blog.rust-lang.org/2016/01/21/Rust-1.6.html#cratesio-disallows-wildcards"
"/rust-2018/documentation/index.html" = "https://doc.rust-lang.org/index.html"
"/rust-2018/documentation/new-editions-of-the-book.html" = "https://doc.rust-jp.rs/book-ja/index.html"
"/rust-2018/documentation/the-rust-bookshelf.html" = "https://doc.rust-lang.org/index.html"
"/rust-2018/documentation/the-rustonomicon.html" = "https://doc.rust-jp.rs/rust-nomicon-ja/index.html"
"/rust-2018/documentation/std-os-has-documentation-for-all-platforms.html" = "https://doc.rust-lang.org/std/os/index.html"
"/rust-2018/rustdoc/index.html" = "https://doc.rust-lang.org/rustdoc/index.html"
"/rust-2018/rustdoc/documentation-tests-can-now-compile-fail.html" = "https://doc.rust-lang.org/rustdoc/documentation-tests.html#attributes"
"/rust-2018/rustdoc/rustdoc-uses-commonmark.html" = "https://doc.rust-lang.org/rustdoc/how-to-write-documentation.html#markdown"
"/rust-2018/platform-and-target-support/index.html" = "https://doc.rust-lang.org/rustc/targets/index.html"
"/rust-2018/platform-and-target-support/libcore-for-low-level-rust.html" = "https://doc.rust-lang.org/core/index.html"
"/rust-2018/platform-and-target-support/webassembly-support.html" = "https://rustwasm.github.io/docs/book/"
"/rust-2018/platform-and-target-support/global-allocators.html" = "https://blog.rust-lang.org/2018/08/02/Rust-1.28.html#global-allocators"
"/rust-2018/platform-and-target-support/msvc-toolchain-support.html" = "https://doc.rust-lang.org/rustc/platform-support.html"
"/rust-2018/platform-and-target-support/musl-support-for-fully-static-binaries.html" = "https://doc.rust-lang.org/rustc/platform-support.html"
"/rust-2018/platform-and-target-support/cdylib-crates-for-c-interoperability.html" = "https://github.com/rust-lang/rfcs/blob/master/text/1510-cdylib.md"
"/rust-next/index.html" = "../rust-post-2018/index.html"
"/rust-next/edition-changes.html" = "../rust-post-2018/edition-changes.html"
# "/rust-next/dbg-macro.html" = "https://doc.rust-lang.org/std/macro.dbg.html"
"/rust-next/dbg-macro.html" = "../rust-post-2018/dbg-macro.html"
# "/rust-next/no-jemalloc.html" = "https://blog.rust-lang.org/2019/01/17/Rust-1.32.0.html#jemalloc-is-removed-by-default"
"/rust-next/no-jemalloc.html" = "../rust-post-2018/no-jemalloc.html"
# "/rust-next/uniform-paths.html" = "https://blog.rust-lang.org/2019/01/17/Rust-1.32.0.html#final-module-improvements"
"/rust-next/uniform-paths.html" = "../rust-post-2018/uniform-paths.html"
# "/rust-next/literal-macro-matcher.html" = "https://blog.rust-lang.org/2019/01/17/Rust-1.32.0.html#macro-improvements"
"/rust-next/literal-macro-matcher.html" = "../rust-post-2018/literal-macro-matcher.html"
# "/rust-next/qustion-mark-operator-in-macros.html" = "https://blog.rust-lang.org/2019/01/17/Rust-1.32.0.html#macro-improvements"
"/rust-next/qustion-mark-operator-in-macros.html" = "../rust-post-2018/question-mark-operator-inmacros.html"
# "/rust-next/const-fn.html" = "https://doc.rust-lang.org/reference/const_eval.html"
"/rust-next/const-fn.html" = "../rust-post-2018/const_fn.html"
# "/rust-next/pin.html" = "https://doc.rust-lang.org/std/pin/index.html"
"/rust-next/pin.html" = "../rust-post-2018/pin.html"
# "/rust-next/no-more-fnbox.html" = "https://blog.rust-lang.org/2019/05/23/Rust-1.35.0.html#fn-closure-traits-implemented-for-boxdyn-fn"
"/rust-next/no-more-fnbox.html" = "https://blog.rust-lang.org/2019/05/23/Rust-1.35.0.html#fn-closure-traits-implemented-for-boxdyn-fn"
# "/rust-next/alternative-cargo-registries.html" = "https://blog.rust-lang.org/2019/04/11/Rust-1.34.0.html#alternative-cargo-registries"
"/rust-next/alternative-cargo-registries.html" = "../rust-post-2018/alternative-cargo-registries.html"
# "/rust-next/tryfrom-and-tryinto.html" = "https://blog.rust-lang.org/2019/04/11/Rust-1.34.0.html#tryfrom-and-tryinto"
"/rust-next/tryfrom-and-tryinto.html" = "../rust-post-2018/tryfrom-and-tryinto.html"
# "/rust-next/future.html" = "https://doc.rust-lang.org/std/future/trait.Future.html"
"/rust-next/future.html" = "../rust-post-2018/future.html"
# "/rust-next/alloc.html" = "https://blog.rust-lang.org/2019/07/04/Rust-1.36.0.html#the-alloc-crate-is-stable"
"/rust-next/alloc.html" = "../rust-post-2018/"
# "/rust-next/maybe-uninit.html" = "https://blog.rust-lang.org/2019/07/04/Rust-1.36.0.html#maybeuninitt-instead-of-memuninitialized"
"/rust-next/maybe-uninit.html" = "../rust-post-2018/aybe-uninit.html"
# "/rust-next/cargo-vendor.html" = "https://doc.rust-lang.org/cargo/commands/cargo-vendor.html"
"/rust-next/cargo-vendor.html" = "../rust-post-2018/cargo-vendor.html"
69 changes: 8 additions & 61 deletions docs/404.html

Large diffs are not rendered by default.

35 changes: 27 additions & 8 deletions docs/book.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,12 @@ function playground_text(playground) {

let text = playground_text(code_block);
let classes = code_block.querySelector('code').classList;
let has_2018 = classes.contains("edition2018");
let edition = has_2018 ? "2018" : "2015";

let edition = "2015";
if(classes.contains("edition2018")) {
edition = "2018";
} else if(classes.contains("edition2021")) {
edition = "2021";
}
var params = {
version: "stable",
optimize: "0",
Expand All @@ -133,7 +136,15 @@ function playground_text(playground) {
body: JSON.stringify(params)
})
.then(response => response.json())
.then(response => result_block.innerText = response.result)
.then(response => {
if (response.result.trim() === '') {
result_block.innerText = "No output";
result_block.classList.add("result-no-output");
} else {
result_block.innerText = response.result;
result_block.classList.remove("result-no-output");
}
})
.catch(error => result_block.innerText = "Playground Communication: " + error.message);
}

Expand All @@ -151,12 +162,13 @@ function playground_text(playground) {
if (window.ace) {
// language-rust class needs to be removed for editable
// blocks or highlightjs will capture events
Array
.from(document.querySelectorAll('code.editable'))
code_nodes
.filter(function (node) {return node.classList.contains("editable"); })
.forEach(function (block) { block.classList.remove('language-rust'); });

Array
.from(document.querySelectorAll('code:not(.editable)'))
code_nodes
.filter(function (node) {return !node.classList.contains("editable"); })
.forEach(function (block) { hljs.highlightBlock(block); });
} else {
code_nodes.forEach(function (block) { hljs.highlightBlock(block); });
Expand Down Expand Up @@ -359,7 +371,14 @@ function playground_text(playground) {
});

themePopup.addEventListener('click', function (e) {
var theme = e.target.id || e.target.parentElement.id;
var theme;
if (e.target.className === "theme") {
theme = e.target.id;
} else if (e.target.parentElement.className === "theme") {
theme = e.target.parentElement.id;
} else {
return;
}
set_theme(theme);
});

Expand Down
2 changes: 1 addition & 1 deletion docs/css/chrome.css
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ a > .hljs {
.menu-title {
display: inline-block;
font-weight: 200;
font-size: 2rem;
font-size: 2.4rem;
line-height: var(--menu-bar-height);
text-align: center;
margin: 0;
Expand Down
25 changes: 16 additions & 9 deletions docs/css/general.css
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,23 @@ h4, h5 { margin-top: 2em; }
margin-top: 1em;
}

h1 a.header:target::before,
h2 a.header:target::before,
h3 a.header:target::before,
h4 a.header:target::before {
h1:target::before,
h2:target::before,
h3:target::before,
h4:target::before,
h5:target::before,
h6:target::before {
display: inline-block;
content: "»";
margin-left: -30px;
width: 30px;
}

h1 a.header:target,
h2 a.header:target,
h3 a.header:target,
h4 a.header:target {
/* This is broken on Safari as of version 14, but is fixed
in Safari Technology Preview 117 which I think will be Safari 14.2.
https://bugs.webkit.org/show_bug.cgi?id=218076
*/
:target {
scroll-margin-top: calc(var(--menu-bar-height) + 0.5em);
}

Expand Down Expand Up @@ -89,7 +92,7 @@ h4 a.header:target {
.content ul { line-height: 1.45em; }
.content a { text-decoration: none; }
.content a:hover { text-decoration: underline; }
.content img { max-width: 100%; }
.content img, .content video { max-width: 100%; }
.content .header:link,
.content .header:visited {
color: var(--fg);
Expand Down Expand Up @@ -172,3 +175,7 @@ blockquote {
margin: 5px 0px;
font-weight: bold;
}

.result-no-output {
font-style: italic;
}
22 changes: 11 additions & 11 deletions docs/css/variables.css
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@

--links: #2b79a2;

--inline-code-color: #c5c8c6;;
--inline-code-color: #c5c8c6;

--theme-popup-bg: #141617;
--theme-popup-border: #43484d;
Expand All @@ -92,22 +92,22 @@

.light {
--bg: hsl(0, 0%, 100%);
--fg: #333333;
--fg: hsl(0, 0%, 0%);

--sidebar-bg: #fafafa;
--sidebar-fg: #364149;
--sidebar-fg: hsl(0, 0%, 0%);
--sidebar-non-existant: #aaaaaa;
--sidebar-active: #008cff;
--sidebar-active: #1f1fff;
--sidebar-spacer: #f4f4f4;

--scrollbar: #cccccc;
--scrollbar: #8F8F8F;

--icons: #cccccc;
--icons-hover: #333333;
--icons: #747474;
--icons-hover: #000000;

--links: #4183c4;
--links: #20609f;

--inline-code-color: #6e6b5e;
--inline-code-color: #301900;

--theme-popup-bg: #fafafa;
--theme-popup-border: #cccccc;
Expand Down Expand Up @@ -147,7 +147,7 @@

--links: #2b79a2;

--inline-code-color: #c5c8c6;;
--inline-code-color: #c5c8c6;

--theme-popup-bg: #161923;
--theme-popup-border: #737480;
Expand Down Expand Up @@ -228,7 +228,7 @@

--links: #2b79a2;

--inline-code-color: #c5c8c6;;
--inline-code-color: #c5c8c6;

--theme-popup-bg: #141617;
--theme-popup-border: #43484d;
Expand Down
Loading