Skip to content

Commit bc23d08

Browse files
authored
Rename playpen to playground. (#1241)
looks good
1 parent fe1ba71 commit bc23d08

File tree

19 files changed

+191
-169
lines changed

19 files changed

+191
-169
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ preprocessors are:
148148
all `README.md` chapters to `index.md` so `foo/README.md` can be accessed via
149149
the url `foo/` when published to a browser
150150
- `links` - a built-in preprocessor (enabled by default) for expanding the
151-
`{{# playpen}}` and `{{# include}}` helpers in a chapter.
151+
`{{# playground}}` and `{{# include}}` helpers in a chapter.
152152
153153
Renderers are given the final book so they can do something with it. This is
154154
typically used for, as the name suggests, rendering the document in a particular

book-example/book.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ edition = "2018"
1010
[output.html]
1111
mathjax-support = true
1212

13-
[output.html.playpen]
13+
[output.html.playground]
1414
editable = true
1515
line-numbers = true
1616

book-example/src/format/config.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ This controls the build process of your book.
100100

101101
The following preprocessors are available and included by default:
102102

103-
- `links`: Expand the `{{ #playpen }}`, `{{ #include }}`, and `{{ #rustdoc_include }}` handlebars
103+
- `links`: Expand the `{{ #playground }}`, `{{ #include }}`, and `{{ #rustdoc_include }}` handlebars
104104
helpers in a chapter to include the contents of a file.
105105
- `index`: Convert all chapter files named `README.md` into `index.md`. That is
106106
to say, all `README.md` would be rendered to an index file `index.html` in the
@@ -191,7 +191,7 @@ The following configuration options are available:
191191
contents column. For example, "1.", "2.1". Set this option to true to disable
192192
those labels. Defaults to `false`.
193193
- **fold:** A subtable for configuring sidebar section-folding behavior.
194-
- **playpen:** A subtable for configuring various playpen settings.
194+
- **playground:** A subtable for configuring various playground settings.
195195
- **search:** A subtable for configuring the in-browser search functionality.
196196
mdBook must be compiled with the `search` feature enabled (on by default).
197197
- **git-repository-url:** A url to the git repository for the book. If provided
@@ -212,7 +212,7 @@ Available configuration options for the `[output.html.fold]` table:
212212
- **level:** The higher the more folded regions are open. When level is 0, all
213213
folds are closed. Defaults to `0`.
214214

215-
Available configuration options for the `[output.html.playpen]` table:
215+
Available configuration options for the `[output.html.playground]` table:
216216

217217
- **editable:** Allow editing the source code. Defaults to `false`.
218218
- **copyable:** Display the copy button on code snippets. Defaults to `true`.
@@ -271,7 +271,7 @@ git-repository-icon = "fa-github"
271271
enable = false
272272
level = 0
273273

274-
[output.html.playpen]
274+
[output.html.playground]
275275
editable = false
276276
copy-js = true
277277
line-numbers = false

book-example/src/format/mdbook.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -92,17 +92,17 @@ impl System for MySystem { ... }
9292
Then in the book, all you have to do is:
9393
````hbs
9494
Here is a component:
95-
```rust,no_run,noplaypen
95+
```rust,no_run,noplayground
9696
\{{#include file.rs:component}}
9797
```
9898
9999
Here is a system:
100-
```rust,no_run,noplaypen
100+
```rust,no_run,noplayground
101101
\{{#include file.rs:system}}
102102
```
103103
104104
This is the full file.
105-
```rust,no_run,noplaypen
105+
```rust,no_run,noplayground
106106
\{{#include file.rs:all}}
107107
```
108108
````
@@ -178,17 +178,17 @@ That is, it looks like this (click the "expand" icon to see the rest of the file
178178
With the following syntax, you can insert runnable Rust files into your book:
179179

180180
```hbs
181-
\{{#playpen file.rs}}
181+
\{{#playground file.rs}}
182182
```
183183

184184
The path to the Rust file has to be relative from the current source file.
185185

186-
When play is clicked, the code snippet will be sent to the [Rust Playpen] to be
186+
When play is clicked, the code snippet will be sent to the [Rust Playground] to be
187187
compiled and run. The result is sent back and displayed directly underneath the
188188
code.
189189

190190
Here is what a rendered code snippet looks like:
191191

192-
{{#playpen example.rs}}
192+
{{#playground example.rs}}
193193

194-
[Rust Playpen]: https://play.rust-lang.org/
194+
[Rust Playground]: https://play.rust-lang.org/

book-example/src/format/theme/editor.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Editor
22

3-
In addition to providing runnable code playpens, mdBook optionally allows them
3+
In addition to providing runnable code playgrounds, mdBook optionally allows them
44
to be editable. In order to enable editable code blocks, the following needs to
55
be added to the ***book.toml***:
66

77
```toml
8-
[output.html.playpen]
8+
[output.html.playground]
99
editable = true
1010
```
1111

@@ -19,7 +19,7 @@ fn main() {
1919
}
2020
```</code></pre>
2121

22-
The above will result in this editable playpen:
22+
The above will result in this editable playground:
2323

2424
```rust,editable
2525
fn main() {
@@ -28,15 +28,15 @@ fn main() {
2828
}
2929
```
3030

31-
Note the new `Undo Changes` button in the editable playpens.
31+
Note the new `Undo Changes` button in the editable playgrounds.
3232

3333
## Customizing the Editor
3434

3535
By default, the editor is the [Ace](https://ace.c9.io/) editor, but, if desired,
3636
the functionality may be overriden by providing a different folder:
3737

3838
```toml
39-
[output.html.playpen]
39+
[output.html.playground]
4040
editable = true
4141
editor = "/path/to/editor"
4242
```

src/config.rs

+18-17
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ impl Config {
158158
/// Fetch an arbitrary item from the `Config` as a `toml::Value`.
159159
///
160160
/// You can use dotted indices to access nested items (e.g.
161-
/// `output.html.playpen` will fetch the "playpen" out of the html output
161+
/// `output.html.playground` will fetch the "playground" out of the html output
162162
/// table).
163163
pub fn get(&self, key: &str) -> Option<&Value> {
164164
self.rest.read(key)
@@ -451,11 +451,11 @@ impl Default for BuildConfig {
451451
}
452452
}
453453

454-
/// Configuration for the Rust compiler(e.g., for playpen)
454+
/// Configuration for the Rust compiler(e.g., for playground)
455455
#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
456456
#[serde(default, rename_all = "kebab-case")]
457457
pub struct RustConfig {
458-
/// Rust edition used in playpen
458+
/// Rust edition used in playground
459459
pub edition: Option<RustEdition>,
460460
}
461461

@@ -496,8 +496,9 @@ pub struct HtmlConfig {
496496
pub additional_js: Vec<PathBuf>,
497497
/// Fold settings.
498498
pub fold: Fold,
499-
/// Playpen settings.
500-
pub playpen: Playpen,
499+
/// Playground settings.
500+
#[serde(alias = "playpen")]
501+
pub playground: Playground,
501502
/// Don't render section labels.
502503
pub no_section_label: bool,
503504
/// Search settings. If `None`, the default will be used.
@@ -533,7 +534,7 @@ impl Default for HtmlConfig {
533534
additional_css: Vec::new(),
534535
additional_js: Vec::new(),
535536
fold: Fold::default(),
536-
playpen: Playpen::default(),
537+
playground: Playground::default(),
537538
no_section_label: false,
538539
search: None,
539540
git_repository_url: None,
@@ -567,24 +568,24 @@ pub struct Fold {
567568
pub level: u8,
568569
}
569570

570-
/// Configuration for tweaking how the the HTML renderer handles the playpen.
571+
/// Configuration for tweaking how the the HTML renderer handles the playground.
571572
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
572573
#[serde(default, rename_all = "kebab-case")]
573-
pub struct Playpen {
574-
/// Should playpen snippets be editable? Default: `false`.
574+
pub struct Playground {
575+
/// Should playground snippets be editable? Default: `false`.
575576
pub editable: bool,
576577
/// Display the copy button. Default: `true`.
577578
pub copyable: bool,
578579
/// Copy JavaScript files for the editor to the output directory?
579580
/// Default: `true`.
580581
pub copy_js: bool,
581-
/// Display line numbers on playpen snippets. Default: `false`.
582+
/// Display line numbers on playground snippets. Default: `false`.
582583
pub line_numbers: bool,
583584
}
584585

585-
impl Default for Playpen {
586-
fn default() -> Playpen {
587-
Playpen {
586+
impl Default for Playground {
587+
fn default() -> Playground {
588+
Playground {
588589
editable: false,
589590
copyable: true,
590591
copy_js: true,
@@ -694,7 +695,7 @@ mod tests {
694695
git-repository-url = "https://foo.com/"
695696
git-repository-icon = "fa-code-fork"
696697
697-
[output.html.playpen]
698+
[output.html.playground]
698699
editable = true
699700
editor = "ace"
700701
@@ -725,7 +726,7 @@ mod tests {
725726
use_default_preprocessors: true,
726727
};
727728
let rust_should_be = RustConfig { edition: None };
728-
let playpen_should_be = Playpen {
729+
let playground_should_be = Playground {
729730
editable: true,
730731
copyable: true,
731732
copy_js: true,
@@ -737,7 +738,7 @@ mod tests {
737738
additional_css: vec![PathBuf::from("./foo/bar/baz.css")],
738739
theme: Some(PathBuf::from("./themedir")),
739740
default_theme: Some(String::from("rust")),
740-
playpen: playpen_should_be,
741+
playground: playground_should_be,
741742
git_repository_url: Some(String::from("https://foo.com/")),
742743
git_repository_icon: Some(String::from("fa-code-fork")),
743744
redirect: vec![
@@ -854,7 +855,7 @@ mod tests {
854855
// is happy...
855856
let src = COMPLEX_CONFIG;
856857
let mut config = Config::from_str(src).unwrap();
857-
let key = "output.html.playpen.editable";
858+
let key = "output.html.playground.editable";
858859

859860
assert_eq!(config.get(key).unwrap(), &Value::Boolean(true));
860861
*config.get_mut(key).unwrap() = Value::Boolean(false);

0 commit comments

Comments
 (0)