The embedded Playground's code reset when you navigate between slides.
This has caused problems: if people navigate away from a slide to look
something up, they've suddenly lost their work.
Added a dev theme to help with slide aspect ratio while updating content
or for reviewing PRs.
Fixes#1796.
---------
Co-authored-by: Dustin J. Mitchell <djmitche@google.com>
Co-authored-by: Martin Geisler <martin@geisler.net>
Before we would run `mdbook test` using the current Markdown sources.
This is subtly wrong: we publish the course using back-dated sources,
so we should therefore also run the tests using the same sources (this
ensures that the code snippets actually work).
After this commit, all translatable content lives in exactly two
directories:
- `src/`
- `third_party/`
We need to restore both directories when testing and when publishing.
This ensures consistency in the Markdown text and in the included
source code.
A new `.github/workflows/build.sh` script takes care of preparing the
two directories according to the date in the PO file (if any).
To ensure we can restore all of `third_party/` to an old commit, the
non-changing `third_party/mdbook/book.js` file has been moved to
`theme/book.js`. The file is generated by `mdbook init --theme`,
making it suitable for modification by the user (us). Symlinks have
been added to `third_party/mdbook/` to indicate that the files
ultimately came from upstream.
I've taken some work by @fw-immunant and others on the new organization
of the course and condensed it into a form amenable to a text editor and
some computational analysis. You can see the inputs in `course.py` but
the interesting bits are the output: `outline.md` and `slides.md`.
The idea is to break the course into more, smaller segments with
exercises at the ends and breaks in between. So `outline.md` lists the
segments, their duration, and sums those durations up per-day. It shows
we're about an hour too long right now! There are more details of the
segments in `slides.md`, or you can see mostly the same stuff in
`course.py`.
This now contains all of the content from the v1 course, ensuring both
that we've covered everything and that we'll have somewhere to redirect
every page.
Fixes#1082.
Fixes#1465.
---------
Co-authored-by: Nicole LeGare <dlegare.1001@gmail.com>
Co-authored-by: Martin Geisler <mgeisler@google.com>
Part of #671
and #1413
In the code part of content which always is in english and must be
`text-align: left` but with `<html ... dir=rtl >` cuz conflict.
---------
Co-authored-by: Kaveh <hamidrkp@riseup.net>
Graduates the Chinese Traditional translation to the language drop-down
selector.
Part of Chinese (Traditional) translation #684.
File stats (Rust Fundamentals):
```
msggrep -v --location=src/{exercises/,}{android,bare-metal,concurrency,async}{.md,"/*","/*/*","/*/*/*"} po/zh-CN.po | msgfmt -o /dev/null --statistics -
1315 translated messages, 146 fuzzy translations, 149 untranslated messages.
```
This also ports over the latest changes to `book.js` and `index.hbs`.
We probably need to come up with a more systematic way of doing this,
e.g., we could store our changes in a patch and automatically attempt to
apply it onto the latest upstream files.
Initially, I also formatted the templates in `theme/`, but this triggers
https://github.com/prettier/prettier/issues/11834. So I exclude them for
now.
---------
Co-authored-by: Ming-Ying Chung <mych@chromium.org>
This will simplify our mdbook updates since there will be fewer
customizations to copy over when a new mdbook version has changes to the
`index.hbs` template.
This updates our `mdbook` version to the latest version in Git. I copied
the `index.hbs` file from that version and back-ported our changes into
it. I checked English and Danish locally and they both look fine.
The new version has support for right-to-left languages:
https://github.com/rust-lang/mdBook/pull/1641.
We have an in-progress Persian translation. Download the `fa.zip`
artifact after building the PR to check how it looks. I checked Persian
locally and it looks mirrored like I expect (but we will need someone
who can read Persian to actually verify this).
Fixes#1164.
I also updated `book.js` and `index.hbs` to the latest versions while
keeping our local modifications.
I tested this locally with `mdbook serve` for both English and
Brazilian Portuguese and everything seems to work fine.
The Danish translation is not yet linked in the language selector
since it is very incomplete. This means that `selectedLang` is `null`
in this case and thus we should not call any methods on it.
The picker is a drop-down menu using the same design as the theme
picker in the top-left.
There doesn’t seem to be an easy way to pass in a list of languages
and descriptions, so for now we’ll have to expand the menu by hand as
we add new languages. A comment has been added to `publish.yml` to
remind us of this.
This replaces a bit of code with the equivalent HTML code.
We also load the script async, which means that the browser won’t
block rendering while waiting for the scripts.
This will allow us to customize the appearance more easily: we can
move the GA logic into the theme (to reduce load times and to simplify
the JS injection logic). We can also add new elements, which is what I
will do next.
The mdbook theme can be added incrementally: if we don’t add a file to
our theme folder, we will get the corresponding file from mdbook.