Revert: Remove the book.multilingual field

This reverts https://github.com/rust-lang/mdBook/pull/2646/ because I
overlooked that this is a public field in a public struct, which would
be a breaking API change.
This commit is contained in:
Eric Huss 2025-05-05 14:01:49 -07:00
parent 17b197620b
commit c9ddb4dd98
4 changed files with 11 additions and 0 deletions

View file

@ -117,6 +117,7 @@ mod nop_lib {
"book": {
"authors": ["AUTHOR"],
"language": "en",
"multilingual": false,
"src": "src",
"title": "TITLE"
},

View file

@ -420,6 +420,8 @@ pub struct BookConfig {
pub description: Option<String>,
/// Location of the book source relative to the book's root directory.
pub src: PathBuf,
/// Does this book support more than one language?
pub multilingual: bool,
/// The main language of the book.
pub language: Option<String>,
/// The direction of text in the book: Left-to-right (LTR) or Right-to-left (RTL).
@ -434,6 +436,7 @@ impl Default for BookConfig {
authors: Vec::new(),
description: None,
src: PathBuf::from("src"),
multilingual: false,
language: Some(String::from("en")),
text_direction: None,
}
@ -817,6 +820,7 @@ mod tests {
title = "Some Book"
authors = ["Michael-F-Bryan <michaelfbryan@gmail.com>"]
description = "A completely useless book"
multilingual = true
src = "source"
language = "ja"
@ -855,6 +859,7 @@ mod tests {
title: Some(String::from("Some Book")),
authors: vec![String::from("Michael-F-Bryan <michaelfbryan@gmail.com>")],
description: Some(String::from("A completely useless book")),
multilingual: true,
src: PathBuf::from("source"),
language: Some(String::from("ja")),
text_direction: None,

View file

@ -28,6 +28,7 @@ All done, no errors...
[book]
authors = []
language = "en"
multilingual = false
src = "src"
"#]],
@ -94,6 +95,7 @@ All done, no errors...
[book]
authors = []
language = "en"
multilingual = false
src = "src"
"#]],
@ -127,6 +129,7 @@ All done, no errors...
[book]
authors = []
language = "en"
multilingual = false
src = "src"
title = "Example title"
@ -179,6 +182,7 @@ fn init_with_custom_book_and_src_locations() {
[book]
authors = []
language = "en"
multilingual = false
src = "in"
[build]

View file

@ -188,6 +188,7 @@ fn backends_receive_render_context_via_stdin() {
"book": {
"authors": [],
"language": "en",
"multilingual": false,
"src": "src"
},
"output": {