diff --git a/rustbook-en/ADMIN_TASKS.md b/rustbook-en/ADMIN_TASKS.md index 7e9ba2c..9caff30 100644 --- a/rustbook-en/ADMIN_TASKS.md +++ b/rustbook-en/ADMIN_TASKS.md @@ -133,3 +133,13 @@ $ dot dot/trpl04-01.dot -Tsvg > src/img/trpl04-01.svg In the generated SVG, remove the width and the height attributes from the `svg` element and set the `viewBox` attribute to `0.00 0.00 1000.00 1000.00` or other values that don't cut off the image. + +## Publish a preview to GitHub Pages + +We sometimes publish to GitHub Pages for in-progress previews. The recommended +flow for publishing is: + +- Install the `ghp-import` tool by running `pip install ghp-import` (or `pipx install ghp-import`, using [pipx][pipx]). +- In the root, run `tools/generate-preview.sh` + +[pipx]: https://pipx.pypa.io/stable/#install-pipx diff --git a/rustbook-en/packages/mdbook-trpl-listing/src/lib.rs b/rustbook-en/packages/mdbook-trpl-listing/src/lib.rs index 7be63e4..619cafd 100644 --- a/rustbook-en/packages/mdbook-trpl-listing/src/lib.rs +++ b/rustbook-en/packages/mdbook-trpl-listing/src/lib.rs @@ -157,7 +157,7 @@ fn rewrite_listing(src: &str, mode: Mode) -> Result { } ev => state.events.push(Ok(ev)), }; - Ok::(state) + Ok::, String>(state) }, )?; @@ -190,7 +190,7 @@ struct ListingState<'e> { impl<'e> ListingState<'e> { fn open_listing( &mut self, - tag: pulldown_cmark::CowStr, + tag: pulldown_cmark::CowStr<'_>, mode: Mode, ) -> Result<(), String> { // We do not *keep* the version constructed here, just temporarily @@ -247,7 +247,7 @@ impl<'e> ListingState<'e> { Ok(()) } - fn close_listing(&mut self, tag: pulldown_cmark::CowStr, mode: Mode) { + fn close_listing(&mut self, tag: pulldown_cmark::CowStr<'_>, mode: Mode) { let trailing = if !tag.ends_with('>') { tag.replace("", "") } else { diff --git a/rustbook-en/tools/generate-preview.sh b/rustbook-en/tools/generate-preview.sh new file mode 100755 index 0000000..a5d9022 --- /dev/null +++ b/rustbook-en/tools/generate-preview.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +mdbook build +cp ./tools/preview-robots.txt ./book/robots.txt +ghp-import -m "rebuild GitHub Pages from generated-book" book +git push origin gh-pages diff --git a/rustbook-en/tools/preview-robots.txt b/rustbook-en/tools/preview-robots.txt new file mode 100644 index 0000000..1f53798 --- /dev/null +++ b/rustbook-en/tools/preview-robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: /