1
Fork 0

Rollup merge of #133930 - chriskrycho:mdbook-trpl-package, r=ehuss

rustbook: update to use new mdbook-trpl package from The Book

Updates to the latest merge from `rust-lang/book` and simplifies the dependency chain there. There are now three preprocessors, but only one package, so everything is a lot nicer to deal with from the consuming POV (i.e. here).
This commit is contained in:
Matthias Krüger 2024-12-06 09:27:40 +01:00 committed by GitHub
commit 026d21d2c1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 36 additions and 33 deletions

@ -1 +1 @@
Subproject commit 614c19cb4025636eb2ba68ebb3d44e3bd3a5e6e4 Subproject commit 9900d976bbfecf4e8124da54351a9ad85ee3c7f3

View file

@ -709,30 +709,20 @@ dependencies = [
] ]
[[package]] [[package]]
name = "mdbook-trpl-listing" name = "mdbook-trpl"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"anyhow",
"clap", "clap",
"html_parser", "html_parser",
"mdbook", "mdbook",
"pulldown-cmark 0.10.3", "pulldown-cmark 0.12.2",
"pulldown-cmark-to-cmark 13.0.0", "pulldown-cmark-to-cmark 19.0.0",
"serde_json", "serde_json",
"thiserror", "thiserror",
"toml 0.8.19", "toml 0.8.19",
] ]
[[package]]
name = "mdbook-trpl-note"
version = "1.0.0"
dependencies = [
"clap",
"mdbook",
"pulldown-cmark 0.10.3",
"pulldown-cmark-to-cmark 13.0.0",
"serde_json",
]
[[package]] [[package]]
name = "memchr" name = "memchr"
version = "2.7.4" version = "2.7.4"
@ -1010,7 +1000,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76979bea66e7875e7509c4ec5300112b316af87fa7a252ca91c448b32dfe3993" checksum = "76979bea66e7875e7509c4ec5300112b316af87fa7a252ca91c448b32dfe3993"
dependencies = [ dependencies = [
"bitflags 2.6.0", "bitflags 2.6.0",
"getopts",
"memchr", "memchr",
"pulldown-cmark-escape 0.10.1", "pulldown-cmark-escape 0.10.1",
"unicase", "unicase",
@ -1028,6 +1017,19 @@ dependencies = [
"unicase", "unicase",
] ]
[[package]]
name = "pulldown-cmark"
version = "0.12.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f86ba2052aebccc42cbbb3ed234b8b13ce76f75c3551a303cb2bcffcff12bb14"
dependencies = [
"bitflags 2.6.0",
"getopts",
"memchr",
"pulldown-cmark-escape 0.11.0",
"unicase",
]
[[package]] [[package]]
name = "pulldown-cmark-escape" name = "pulldown-cmark-escape"
version = "0.10.1" version = "0.10.1"
@ -1040,15 +1042,6 @@ version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "007d8adb5ddab6f8e3f491ac63566a7d5002cc7ed73901f72057943fa71ae1ae" checksum = "007d8adb5ddab6f8e3f491ac63566a7d5002cc7ed73901f72057943fa71ae1ae"
[[package]]
name = "pulldown-cmark-to-cmark"
version = "13.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f609795c8d835f79dcfcf768415b9fb57ef1b74891e99f86e73f43a7a257163b"
dependencies = [
"pulldown-cmark 0.10.3",
]
[[package]] [[package]]
name = "pulldown-cmark-to-cmark" name = "pulldown-cmark-to-cmark"
version = "15.0.1" version = "15.0.1"
@ -1058,6 +1051,15 @@ dependencies = [
"pulldown-cmark 0.11.3", "pulldown-cmark 0.11.3",
] ]
[[package]]
name = "pulldown-cmark-to-cmark"
version = "19.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d742adcc7b655dba3e9ebab47954ca229fc0fa1df01fdc94349b6f3a2e6d257"
dependencies = [
"pulldown-cmark 0.12.2",
]
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.37" version = "1.0.37"
@ -1144,8 +1146,7 @@ dependencies = [
"mdbook", "mdbook",
"mdbook-i18n-helpers", "mdbook-i18n-helpers",
"mdbook-spec", "mdbook-spec",
"mdbook-trpl-listing", "mdbook-trpl",
"mdbook-trpl-note",
] ]
[[package]] [[package]]

View file

@ -9,8 +9,7 @@ edition = "2021"
[dependencies] [dependencies]
clap = "4.0.32" clap = "4.0.32"
env_logger = "0.11" env_logger = "0.11"
mdbook-trpl-listing = { path = "../../doc/book/packages/mdbook-trpl-listing" } mdbook-trpl = { path = "../../doc/book/packages/mdbook-trpl" }
mdbook-trpl-note = { path = "../../doc/book/packages/mdbook-trpl-note" }
mdbook-i18n-helpers = "0.3.3" mdbook-i18n-helpers = "0.3.3"
mdbook-spec = { path = "../../doc/reference/mdbook-spec" } mdbook-spec = { path = "../../doc/reference/mdbook-spec" }

View file

@ -6,8 +6,7 @@ use mdbook::MDBook;
use mdbook::errors::Result as Result3; use mdbook::errors::Result as Result3;
use mdbook_i18n_helpers::preprocessors::Gettext; use mdbook_i18n_helpers::preprocessors::Gettext;
use mdbook_spec::Spec; use mdbook_spec::Spec;
use mdbook_trpl_listing::TrplListing; use mdbook_trpl::{Figure, Listing, Note};
use mdbook_trpl_note::TrplNote;
fn main() { fn main() {
let crate_version = concat!("v", crate_version!()); let crate_version = concat!("v", crate_version!());
@ -109,11 +108,15 @@ pub fn build(args: &ArgMatches) -> Result3<()> {
// preprocessor, or this should modify the config and use // preprocessor, or this should modify the config and use
// MDBook::load_with_config. // MDBook::load_with_config.
if book.config.get_preprocessor("trpl-note").is_some() { if book.config.get_preprocessor("trpl-note").is_some() {
book.with_preprocessor(TrplNote); book.with_preprocessor(Note);
} }
if book.config.get_preprocessor("trpl-listing").is_some() { if book.config.get_preprocessor("trpl-listing").is_some() {
book.with_preprocessor(TrplListing); book.with_preprocessor(Listing);
}
if book.config.get_preprocessor("trpl-figure").is_some() {
book.with_preprocessor(Figure);
} }
if book.config.get_preprocessor("spec").is_some() { if book.config.get_preprocessor("spec").is_some() {