Auto merge of #126056 - matthiaskrgr:rollup-ytwg62v, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #124731 (Add translation support by mdbook-i18n-helpers to bootstrap)
 - #125168 (Match ergonomics 2024: align implementation with RFC)
 - #125925 (Don't trigger `unsafe_op_in_unsafe_fn` for deprecated safe fns)
 - #125987 (When `derive`ing, account for HRTB on `BareFn` fields)
 - #126045 (check_expr_struct_fields: taint context with errors if struct definit…)
 - #126048 (Fix typos in cargo-specifics.md)

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2024-06-06 05:56:06 +00:00
commit 2b6a34273d
35 changed files with 642 additions and 425 deletions

View file

@ -9,6 +9,7 @@ clap = "4.0.32"
env_logger = "0.11"
mdbook-trpl-listing = { path = "../../doc/book/packages/mdbook-trpl-listing" }
mdbook-trpl-note = { path = "../../doc/book/packages/mdbook-trpl-note" }
mdbook-i18n-helpers = "0.3.3"
[dependencies.mdbook]
version = "0.4.37"

View file

@ -7,6 +7,7 @@ use clap::{arg, ArgMatches, Command};
use mdbook::errors::Result as Result3;
use mdbook::MDBook;
use mdbook_i18n_helpers::preprocessors::Gettext;
use mdbook_trpl_listing::TrplListing;
use mdbook_trpl_note::TrplNote;
@ -19,6 +20,11 @@ fn main() {
.required(false)
.value_parser(clap::value_parser!(PathBuf));
let l_arg = arg!(-l --"lang" <LANGUAGE>
"The output language")
.required(false)
.value_parser(clap::value_parser!(String));
let dir_arg = arg!([dir] "Root directory for the book\n\
(Defaults to the current directory when omitted)")
.value_parser(clap::value_parser!(PathBuf));
@ -33,6 +39,7 @@ fn main() {
Command::new("build")
.about("Build the book from the markdown files")
.arg(d_arg)
.arg(l_arg)
.arg(&dir_arg),
)
.subcommand(
@ -63,6 +70,12 @@ pub fn build(args: &ArgMatches) -> Result3<()> {
let book_dir = get_book_dir(args);
let mut book = load_book(&book_dir)?;
if let Some(lang) = args.get_one::<String>("lang") {
let gettext = Gettext;
book.with_preprocessor(gettext);
book.config.set("book.language", lang).unwrap();
}
// Set this to allow us to catch bugs in advance.
book.config.build.create_missing = false;