diff --git a/packages/mdbook-trpl-note/Cargo.lock b/packages/mdbook-trpl-note/Cargo.lock deleted file mode 100644 index 25a63dab12..0000000000 --- a/packages/mdbook-trpl-note/Cargo.lock +++ /dev/null @@ -1,1087 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "aho-corasick" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" -dependencies = [ - "memchr", -] - -[[package]] -name = "android-tzdata" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" - -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - -[[package]] -name = "anstream" -version = "0.6.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" -dependencies = [ - "anstyle", - "anstyle-parse", - "anstyle-query", - "anstyle-wincon", - "colorchoice", - "is_terminal_polyfill", - "utf8parse", -] - -[[package]] -name = "anstyle" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" - -[[package]] -name = "anstyle-parse" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" -dependencies = [ - "utf8parse", -] - -[[package]] -name = "anstyle-query" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a64c907d4e79225ac72e2a354c9ce84d50ebb4586dee56c82b3ee73004f537f5" -dependencies = [ - "windows-sys 0.52.0", -] - -[[package]] -name = "anstyle-wincon" -version = "3.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" -dependencies = [ - "anstyle", - "windows-sys 0.52.0", -] - -[[package]] -name = "anyhow" -version = "1.0.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" - -[[package]] -name = "assert_cmd" -version = "2.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed72493ac66d5804837f480ab3766c72bdfab91a65e565fc54fa9e42db0073a8" -dependencies = [ - "anstyle", - "bstr", - "doc-comment", - "predicates", - "predicates-core", - "predicates-tree", - "wait-timeout", -] - -[[package]] -name = "autocfg" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" - -[[package]] -name = "bitflags" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" - -[[package]] -name = "block-buffer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" -dependencies = [ - "generic-array", -] - -[[package]] -name = "bstr" -version = "1.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05efc5cfd9110c8416e471df0e96702d58690178e206e61b7173706673c93706" -dependencies = [ - "memchr", - "regex-automata", - "serde", -] - -[[package]] -name = "bumpalo" -version = "3.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" - -[[package]] -name = "cc" -version = "1.0.98" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41c270e7540d725e65ac7f1b212ac8ce349719624d7bcff99f8e2e488e8cf03f" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "chrono" -version = "0.4.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" -dependencies = [ - "android-tzdata", - "iana-time-zone", - "num-traits", - "windows-targets 0.52.5", -] - -[[package]] -name = "clap" -version = "4.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" -dependencies = [ - "clap_builder", - "clap_derive", -] - -[[package]] -name = "clap_builder" -version = "4.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" -dependencies = [ - "anstream", - "anstyle", - "clap_lex", - "strsim", - "terminal_size", -] - -[[package]] -name = "clap_complete" -version = "4.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd79504325bf38b10165b02e89b4347300f855f273c4cb30c4a3209e6583275e" -dependencies = [ - "clap", -] - -[[package]] -name = "clap_derive" -version = "4.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "clap_lex" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" - -[[package]] -name = "colorchoice" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" - -[[package]] -name = "core-foundation-sys" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" - -[[package]] -name = "cpufeatures" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" -dependencies = [ - "libc", -] - -[[package]] -name = "crypto-common" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" -dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "dbus" -version = "0.9.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bb21987b9fb1613058ba3843121dd18b163b254d8a6e797e144cbac14d96d1b" -dependencies = [ - "libc", - "libdbus-sys", - "winapi", -] - -[[package]] -name = "difflib" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8" - -[[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "block-buffer", - "crypto-common", -] - -[[package]] -name = "doc-comment" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" - -[[package]] -name = "env_filter" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a009aa4810eb158359dda09d0c87378e4bbb89b5a801f016885a4707ba24f7ea" -dependencies = [ - "log", - "regex", -] - -[[package]] -name = "env_logger" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38b35839ba51819680ba087cd351788c9a3c476841207e0b8cee0b04722343b9" -dependencies = [ - "anstream", - "anstyle", - "env_filter", - "humantime", - "log", -] - -[[package]] -name = "errno" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - -[[package]] -name = "fastrand" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" - -[[package]] -name = "generic-array" -version = "0.14.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check", -] - -[[package]] -name = "getopts" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" -dependencies = [ - "unicode-width", -] - -[[package]] -name = "handlebars" -version = "5.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d08485b96a0e6393e9e4d1b8d48cf74ad6c063cd905eb33f42c1ce3f0377539b" -dependencies = [ - "log", - "pest", - "pest_derive", - "serde", - "serde_json", - "thiserror", -] - -[[package]] -name = "heck" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" - -[[package]] -name = "humantime" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" - -[[package]] -name = "iana-time-zone" -version = "0.1.60" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "wasm-bindgen", - "windows-core", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" -dependencies = [ - "cc", -] - -[[package]] -name = "is_terminal_polyfill" -version = "1.70.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" - -[[package]] -name = "itoa" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" - -[[package]] -name = "js-sys" -version = "0.3.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "libc" -version = "0.2.155" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" - -[[package]] -name = "libdbus-sys" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06085512b750d640299b79be4bad3d2fa90a9c00b1fd9e1b46364f66f0485c72" -dependencies = [ - "cc", - "pkg-config", -] - -[[package]] -name = "linux-raw-sys" -version = "0.4.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" - -[[package]] -name = "log" -version = "0.4.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" - -[[package]] -name = "mdbook" -version = "0.4.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b45a38e19bd200220ef07c892b0157ad3d2365e5b5a267ca01ad12182491eea5" -dependencies = [ - "anyhow", - "chrono", - "clap", - "clap_complete", - "env_logger", - "handlebars", - "log", - "memchr", - "once_cell", - "opener", - "pulldown-cmark", - "regex", - "serde", - "serde_json", - "shlex", - "tempfile", - "toml", - "topological-sort", -] - -[[package]] -name = "mdbook-trpl-note" -version = "1.0.0" -dependencies = [ - "assert_cmd", - "clap", - "mdbook", - "pulldown-cmark", - "pulldown-cmark-to-cmark", - "serde_json", -] - -[[package]] -name = "memchr" -version = "2.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" - -[[package]] -name = "normpath" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5831952a9476f2fed74b77d74182fa5ddc4d21c72ec45a333b250e3ed0272804" -dependencies = [ - "windows-sys 0.52.0", -] - -[[package]] -name = "num-traits" -version = "0.2.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", -] - -[[package]] -name = "once_cell" -version = "1.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" - -[[package]] -name = "opener" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8df34be653210fbe9ffaff41d3b92721c56ce82dfee58ee684f9afb5e3a90c0" -dependencies = [ - "bstr", - "dbus", - "normpath", - "windows-sys 0.52.0", -] - -[[package]] -name = "pest" -version = "2.7.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "560131c633294438da9f7c4b08189194b20946c8274c6b9e38881a7874dc8ee8" -dependencies = [ - "memchr", - "thiserror", - "ucd-trie", -] - -[[package]] -name = "pest_derive" -version = "2.7.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26293c9193fbca7b1a3bf9b79dc1e388e927e6cacaa78b4a3ab705a1d3d41459" -dependencies = [ - "pest", - "pest_generator", -] - -[[package]] -name = "pest_generator" -version = "2.7.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ec22af7d3fb470a85dd2ca96b7c577a1eb4ef6f1683a9fe9a8c16e136c04687" -dependencies = [ - "pest", - "pest_meta", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "pest_meta" -version = "2.7.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7a240022f37c361ec1878d646fc5b7d7c4d28d5946e1a80ad5a7a4f4ca0bdcd" -dependencies = [ - "once_cell", - "pest", - "sha2", -] - -[[package]] -name = "pkg-config" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" - -[[package]] -name = "predicates" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b87bfd4605926cdfefc1c3b5f8fe560e3feca9d5552cf68c466d3d8236c7e8" -dependencies = [ - "anstyle", - "difflib", - "predicates-core", -] - -[[package]] -name = "predicates-core" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b794032607612e7abeb4db69adb4e33590fa6cf1149e95fd7cb00e634b92f174" - -[[package]] -name = "predicates-tree" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368ba315fb8c5052ab692e68a0eefec6ec57b23a36959c14496f0b0df2c0cecf" -dependencies = [ - "predicates-core", - "termtree", -] - -[[package]] -name = "proc-macro2" -version = "1.0.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b33eb56c327dec362a9e55b3ad14f9d2f0904fb5a5b03b513ab5465399e9f43" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "pulldown-cmark" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76979bea66e7875e7509c4ec5300112b316af87fa7a252ca91c448b32dfe3993" -dependencies = [ - "bitflags", - "getopts", - "memchr", - "pulldown-cmark-escape", - "unicase", -] - -[[package]] -name = "pulldown-cmark-escape" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd348ff538bc9caeda7ee8cad2d1d48236a1f443c1fa3913c6a02fe0043b1dd3" - -[[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", -] - -[[package]] -name = "quote" -version = "1.0.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "regex" -version = "1.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" - -[[package]] -name = "rustix" -version = "0.38.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" -dependencies = [ - "bitflags", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.52.0", -] - -[[package]] -name = "ryu" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" - -[[package]] -name = "serde" -version = "1.0.202" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "226b61a0d411b2ba5ff6d7f73a476ac4f8bb900373459cd00fab8512828ba395" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.202" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6048858004bcff69094cd972ed40a32500f153bd3be9f716b2eed2e8217c4838" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.117" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "sha2" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest", -] - -[[package]] -name = "shlex" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" - -[[package]] -name = "strsim" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" - -[[package]] -name = "syn" -version = "2.0.65" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2863d96a84c6439701d7a38f9de935ec562c8832cc55d1dde0f513b52fad106" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "tempfile" -version = "3.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" -dependencies = [ - "cfg-if", - "fastrand", - "rustix", - "windows-sys 0.52.0", -] - -[[package]] -name = "terminal_size" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" -dependencies = [ - "rustix", - "windows-sys 0.48.0", -] - -[[package]] -name = "termtree" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" - -[[package]] -name = "thiserror" -version = "1.0.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "toml" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" -dependencies = [ - "serde", -] - -[[package]] -name = "topological-sort" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea68304e134ecd095ac6c3574494fc62b909f416c4fca77e440530221e549d3d" - -[[package]] -name = "typenum" -version = "1.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" - -[[package]] -name = "ucd-trie" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" - -[[package]] -name = "unicase" -version = "2.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" -dependencies = [ - "version_check", -] - -[[package]] -name = "unicode-ident" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" - -[[package]] -name = "unicode-width" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f5e5f3158ecfd4b8ff6fe086db7c8467a2dfdac97fe420f2b7c4aa97af66d6" - -[[package]] -name = "utf8parse" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" - -[[package]] -name = "version_check" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wait-timeout" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6" -dependencies = [ - "libc", -] - -[[package]] -name = "wasm-bindgen" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows-core" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" -dependencies = [ - "windows-targets 0.52.5", -] - -[[package]] -name = "windows-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets 0.48.5", -] - -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets 0.52.5", -] - -[[package]] -name = "windows-targets" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" -dependencies = [ - "windows_aarch64_gnullvm 0.48.5", - "windows_aarch64_msvc 0.48.5", - "windows_i686_gnu 0.48.5", - "windows_i686_msvc 0.48.5", - "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm 0.48.5", - "windows_x86_64_msvc 0.48.5", -] - -[[package]] -name = "windows-targets" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" -dependencies = [ - "windows_aarch64_gnullvm 0.52.5", - "windows_aarch64_msvc 0.52.5", - "windows_i686_gnu 0.52.5", - "windows_i686_gnullvm", - "windows_i686_msvc 0.52.5", - "windows_x86_64_gnu 0.52.5", - "windows_x86_64_gnullvm 0.52.5", - "windows_x86_64_msvc 0.52.5", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" - -[[package]] -name = "windows_i686_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" diff --git a/packages/mdbook-trpl-note/Cargo.toml b/packages/mdbook-trpl-note/Cargo.toml deleted file mode 100644 index 4fde2fd878..0000000000 --- a/packages/mdbook-trpl-note/Cargo.toml +++ /dev/null @@ -1,21 +0,0 @@ -[package] -name = "mdbook-trpl-note" -version = "1.0.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -clap = { version = "4", features = ["derive"] } -mdbook = { version = "0.4", default-features = false } # only need the library -pulldown-cmark = { version = "0.10", features = ["simd"] } -pulldown-cmark-to-cmark = "13" -serde_json = "1" - -[dev-dependencies] -assert_cmd = "2" - -# This package is used as a path dependency in `rust-lang/rust`, not published -# to crates.io, so it cannot be part of the `rust-lang/book` workspace, because -# path dependencies do not get built as a crate within the hosting workspace. -[workspace] diff --git a/packages/mdbook-trpl-note/src/lib.rs b/packages/mdbook-trpl-note/src/lib.rs deleted file mode 100644 index 115641bac2..0000000000 --- a/packages/mdbook-trpl-note/src/lib.rs +++ /dev/null @@ -1,346 +0,0 @@ -use mdbook::{ - book::Book, - errors::Result, - preprocess::{Preprocessor, PreprocessorContext}, - utils::new_cmark_parser, - BookItem, -}; -use pulldown_cmark::{ - Event::{self, *}, - Tag, TagEnd, -}; -use pulldown_cmark_to_cmark::cmark; - -/// A simple preprocessor for semantic notes in _The Rust Programming Language_. -/// -/// Takes in Markdown like this: -/// -/// ```markdown -/// > Note: This is a note. -/// ``` -/// -/// Spits out Markdown like this: -/// -/// ```markdown -///
-/// -/// This is a note. -/// -///
-/// ``` -pub struct TrplNote; - -impl Preprocessor for TrplNote { - fn name(&self) -> &str { - "simple-note-preprocessor" - } - - fn run( - &self, - _ctx: &PreprocessorContext, - mut book: Book, - ) -> Result { - book.for_each_mut(|item| { - if let BookItem::Chapter(ref mut chapter) = item { - chapter.content = rewrite(&chapter.content); - } - }); - Ok(book) - } - - fn supports_renderer(&self, renderer: &str) -> bool { - renderer == "html" || renderer == "markdown" || renderer == "test" - } -} - -pub fn rewrite(text: &str) -> String { - let parser = new_cmark_parser(text, true); - - let mut events = Vec::new(); - let mut state = Default; - - for event in parser { - match (&mut state, event) { - (Default, Start(Tag::BlockQuote)) => { - state = StartingBlockquote(vec![Start(Tag::BlockQuote)]); - } - - (StartingBlockquote(blockquote_events), Text(content)) => { - if content.starts_with("Note: ") { - // This needs the "extra" `SoftBreak`s so that when the final rendering pass - // happens, it does not end up treating the internal content as inline *or* - // treating the HTML tags as inline tags: - // - // - Content inside HTML blocks is only rendered as Markdown when it is - // separated from the block HTML elements: otherwise it gets treated as inline - // HTML and *not* rendered. - // - Along the same lines, an HTML tag that happens to be directly adjacent to - // the end of a previous Markdown block will end up being rendered as part of - // that block. - events.extend([ - SoftBreak, - SoftBreak, - Html( - r#"
"#.into(), - ), - SoftBreak, - SoftBreak, - Start(Tag::Paragraph), - Text(content), - ]); - state = InNote; - } else { - events.append(blockquote_events); - events.push(Text(content)); - state = Default; - } - } - - ( - StartingBlockquote(_blockquote_events), - heading @ Start(Tag::Heading { .. }), - ) => { - events.extend([ - SoftBreak, - SoftBreak, - Html(r#"
"#.into()), - SoftBreak, - SoftBreak, - heading, - ]); - state = InNote; - } - - (StartingBlockquote(ref mut events), Start(tag)) => { - events.push(Start(tag)); - } - - (InNote, End(TagEnd::BlockQuote)) => { - // As with the start of the block HTML, the closing HTML must be - // separated from the Markdown text by two newlines. - events.extend([ - SoftBreak, - SoftBreak, - Html("
".into()), - ]); - state = Default; - } - - (_, event) => { - events.push(event); - } - } - } - - let mut buf = String::new(); - cmark(events.into_iter(), &mut buf).unwrap(); - buf -} - -use State::*; - -#[derive(Debug)] -enum State<'e> { - Default, - StartingBlockquote(Vec>), - InNote, -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn no_note() { - let text = "Hello, world.\n\nThis is some text."; - let processed = rewrite(text); - assert_eq!( - render_markdown(&processed), - "

Hello, world.

\n

This is some text.

\n" - ); - } - - #[test] - fn with_note() { - let text = "> Note: This is some text.\n> It keeps going."; - let processed = rewrite(text); - assert_eq!( - render_markdown(&processed), - "
\n

Note: This is some text.\nIt keeps going.

\n
" - ); - } - - #[test] - fn regular_blockquote() { - let text = "> This is some text.\n> It keeps going."; - let processed = rewrite(text); - assert_eq!( - render_markdown(&processed), - "
\n

This is some text.\nIt keeps going.

\n
\n" - ); - } - - #[test] - fn combined() { - let text = "> Note: This is some text.\n> It keeps going.\n\nThis is regular text.\n\n> This is a blockquote.\n"; - let processed = rewrite(text); - assert_eq!( - render_markdown(&processed), - "
\n

Note: This is some text.\nIt keeps going.

\n
\n

This is regular text.

\n
\n

This is a blockquote.

\n
\n" - ); - } - - #[test] - fn blockquote_then_note() { - let text = "> This is quoted.\n\n> Note: This is noted."; - let processed = rewrite(text); - assert_eq!( - render_markdown(&processed), - "
\n

This is quoted.

\n
\n
\n

Note: This is noted.

\n
" - ); - } - - #[test] - fn note_then_blockquote() { - let text = "> Note: This is noted.\n\n> This is quoted."; - let processed = rewrite(text); - assert_eq!( - render_markdown(&processed), - "
\n

Note: This is noted.

\n
\n
\n

This is quoted.

\n
\n" - ); - } - - #[test] - fn with_h1_note() { - let text = "> # Header\n > And then some note content."; - let processed = rewrite(text); - assert_eq!( - render_markdown(&processed), - "
\n

Header

\n

And then some note content.

\n
" - ); - } - - #[test] - fn with_h2_note() { - let text = "> ## Header\n > And then some note content."; - let processed = rewrite(text); - assert_eq!( - render_markdown(&processed), - "
\n

Header

\n

And then some note content.

\n
" - ); - } - - #[test] - fn with_h3_note() { - let text = "> ### Header\n > And then some note content."; - let processed = rewrite(text); - assert_eq!( - render_markdown(&processed), - "
\n

Header

\n

And then some note content.

\n
" - ); - } - - #[test] - fn with_h4_note() { - let text = "> #### Header\n > And then some note content."; - let processed = rewrite(text); - assert_eq!( - render_markdown(&processed), - "
\n

Header

\n

And then some note content.

\n
" - ); - } - - #[test] - fn with_h5_note() { - let text = "> ##### Header\n > And then some note content."; - let processed = rewrite(text); - assert_eq!( - render_markdown(&processed), - "
\n
Header
\n

And then some note content.

\n
" - ); - } - - #[test] - fn with_h6_note() { - let text = "> ###### Header\n > And then some note content."; - let processed = rewrite(text); - assert_eq!( - render_markdown(&processed), - "
\n
Header
\n

And then some note content.

\n
" - ); - } - - #[test] - fn h1_then_blockquote() { - let text = - "> # Header\n > And then some note content.\n\n> This is quoted."; - let processed = rewrite(text); - assert_eq!( - render_markdown(&processed), - "
\n

Header

\n

And then some note content.

\n
\n
\n

This is quoted.

\n
\n" - ); - } - - #[test] - fn blockquote_then_h1_note() { - let text = - "> This is quoted.\n\n> # Header\n > And then some note content."; - let processed = rewrite(text); - assert_eq!( - render_markdown(&processed), - "
\n

This is quoted.

\n
\n
\n

Header

\n

And then some note content.

\n
" - ); - } - - #[test] - fn blockquote_with_strong() { - let text = "> **Bold text in a paragraph.**"; - let processed = rewrite(text); - assert_eq!( - render_markdown(&processed), - "
\n

Bold text in a paragraph.

\n
\n" - ); - } - - #[test] - fn normal_table() { - let text = "| Header 1 | Header 2 |\n| -------- | -------- |\n| Text 123 | More 456 |"; - let processed = rewrite(text); - - assert_eq!( - processed, - "|Header 1|Header 2|\n|--------|--------|\n|Text 123|More 456|", - "It strips some whitespace but otherwise leaves the table intact." - ); - } - - #[test] - fn table_in_note() { - let text = "> Note: table stuff.\n\n| Header 1 | Header 2 |\n| -------- | -------- |\n| Text 123 | More 456 |"; - let processed = rewrite(text); - - assert_eq!( - processed, - "\n\n
\n\nNote: table stuff.\n\n
\n\n|Header 1|Header 2|\n|--------|--------|\n|Text 123|More 456|", - "It adds the note markup but leaves the table untouched, to be rendered as Markdown." - ); - } - - #[test] - fn table_in_quote() { - let text = "> A table.\n\n| Header 1 | Header 2 |\n| -------- | -------- |\n| Text 123 | More 456 |"; - let processed = rewrite(text); - assert_eq!( - render_markdown(&processed), - "
\n

A table.

\n
\n\n\n
Header 1Header 2
Text 123More 456
\n", - "It renders blockquotes with nested tables as expected." - ); - } - - fn render_markdown(text: &str) -> String { - let parser = new_cmark_parser(text, true); - let mut buf = String::new(); - pulldown_cmark::html::push_html(&mut buf, parser); - buf - } -} diff --git a/packages/mdbook-trpl-note/tests/integration/main.rs b/packages/mdbook-trpl-note/tests/integration/main.rs deleted file mode 100644 index 6944fae693..0000000000 --- a/packages/mdbook-trpl-note/tests/integration/main.rs +++ /dev/null @@ -1,22 +0,0 @@ -use assert_cmd::Command; - -#[test] -fn supports_html_renderer() { - let cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")) - .unwrap() - .args(["supports", "html"]) - .ok(); - assert!(cmd.is_ok()); -} - -#[test] -fn errors_for_other_renderers() { - let cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")) - .unwrap() - .args(["supports", "total-nonsense"]) - .ok(); - assert!(cmd.is_err()); -} - -// It would be nice to add an actual fixture for an mdbook, but doing *that* is -// going to be a bit of a pain, and what I have should cover it for now. diff --git a/packages/mdbook-trpl-listing/Cargo.lock b/packages/mdbook_trpl/Cargo.lock similarity index 67% rename from packages/mdbook-trpl-listing/Cargo.lock rename to packages/mdbook_trpl/Cargo.lock index c61da8a7f4..adfb4f1eeb 100644 --- a/packages/mdbook-trpl-listing/Cargo.lock +++ b/packages/mdbook_trpl/Cargo.lock @@ -28,9 +28,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.14" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" +checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" dependencies = [ "anstyle", "anstyle-parse", @@ -43,53 +43,54 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.7" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" +checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" [[package]] name = "anstyle-parse" -version = "0.2.4" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" +checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.0.3" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a64c907d4e79225ac72e2a354c9ce84d50ebb4586dee56c82b3ee73004f537f5" +checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.3" +version = "3.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" +checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125" dependencies = [ "anstyle", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" [[package]] name = "assert_cmd" -version = "2.0.14" +version = "2.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed72493ac66d5804837f480ab3766c72bdfab91a65e565fc54fa9e42db0073a8" +checksum = "dc1835b7f27878de8525dc71410b5a31cdcc5f230aed5ba5df968e09c201b23d" dependencies = [ "anstyle", "bstr", "doc-comment", + "libc", "predicates", "predicates-core", "predicates-tree", @@ -98,15 +99,15 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "block-buffer" @@ -119,9 +120,9 @@ dependencies = [ [[package]] name = "bstr" -version = "1.9.1" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05efc5cfd9110c8416e471df0e96702d58690178e206e61b7173706673c93706" +checksum = "40723b8fb387abc38f4f4a37c09073622e41dd12327033091ef8950659e6dc0c" dependencies = [ "memchr", "regex-automata", @@ -136,9 +137,12 @@ checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "cc" -version = "1.0.98" +version = "1.1.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41c270e7540d725e65ac7f1b212ac8ce349719624d7bcff99f8e2e488e8cf03f" +checksum = "40545c26d092346d8a8dab71ee48e7685a7a9cba76e634790c215b41a4a7b4cf" +dependencies = [ + "shlex", +] [[package]] name = "cfg-if" @@ -155,14 +159,14 @@ dependencies = [ "android-tzdata", "iana-time-zone", "num-traits", - "windows-targets 0.52.5", + "windows-targets", ] [[package]] name = "clap" -version = "4.5.4" +version = "4.5.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" +checksum = "b97f376d85a664d5837dbae44bf546e6477a679ff6610010f17276f686d867e8" dependencies = [ "clap_builder", "clap_derive", @@ -170,9 +174,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.2" +version = "4.5.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" +checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54" dependencies = [ "anstream", "anstyle", @@ -183,18 +187,18 @@ dependencies = [ [[package]] name = "clap_complete" -version = "4.5.2" +version = "4.5.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd79504325bf38b10165b02e89b4347300f855f273c4cb30c4a3209e6583275e" +checksum = "11611dca53440593f38e6b25ec629de50b14cdfa63adc0fb856115a2c6d97595" dependencies = [ "clap", ] [[package]] name = "clap_derive" -version = "4.5.4" +version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64" +checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" dependencies = [ "heck", "proc-macro2", @@ -204,27 +208,27 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.7.0" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" +checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" [[package]] name = "colorchoice" -version = "1.0.1" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" +checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" [[package]] name = "core-foundation-sys" -version = "0.8.6" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpufeatures" -version = "0.2.12" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" dependencies = [ "libc", ] @@ -274,9 +278,9 @@ checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" [[package]] name = "env_filter" -version = "0.1.0" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a009aa4810eb158359dda09d0c87378e4bbb89b5a801f016885a4707ba24f7ea" +checksum = "4f2c92ceda6ceec50f43169f9ee8424fe2db276791afde7b2cd8bc084cb376ab" dependencies = [ "log", "regex", @@ -284,9 +288,9 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.11.3" +version = "0.11.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38b35839ba51819680ba087cd351788c9a3c476841207e0b8cee0b04722343b9" +checksum = "e13fa619b91fb2381732789fc5de83b45675e882f66623b7d8cb4f643017018d" dependencies = [ "anstream", "anstyle", @@ -313,9 +317,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" +checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4" [[package]] name = "generic-array" @@ -338,11 +342,12 @@ dependencies = [ [[package]] name = "handlebars" -version = "5.1.2" +version = "6.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d08485b96a0e6393e9e4d1b8d48cf74ad6c063cd905eb33f42c1ce3f0377539b" +checksum = "fd4ccde012831f9a071a637b0d4e31df31c0f6c525784b35ae76a9ac6bc1e315" dependencies = [ "log", + "num-order", "pest", "pest_derive", "serde", @@ -352,9 +357,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.14.5" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3" [[package]] name = "heck" @@ -385,9 +390,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "iana-time-zone" -version = "0.1.60" +version = "0.1.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" +checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -408,9 +413,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.6" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ "equivalent", "hashbrown", @@ -418,9 +423,9 @@ dependencies = [ [[package]] name = "is_terminal_polyfill" -version = "1.70.0" +version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" [[package]] name = "itoa" @@ -430,18 +435,18 @@ checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "js-sys" -version = "0.3.69" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" dependencies = [ "wasm-bindgen", ] [[package]] name = "libc" -version = "0.2.155" +version = "0.2.162" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +checksum = "18d287de67fe55fd7e1581fe933d965a5a9477b38e949cfa9f8574ef01506398" [[package]] name = "libdbus-sys" @@ -461,15 +466,15 @@ checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "log" -version = "0.4.21" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] name = "mdbook" -version = "0.4.40" +version = "0.4.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b45a38e19bd200220ef07c892b0157ad3d2365e5b5a267ca01ad12182491eea5" +checksum = "7624879735513024d323e7267a0b3a7176aceb0db537939beb4ee31d9e8945e3" dependencies = [ "anyhow", "chrono", @@ -492,7 +497,7 @@ dependencies = [ ] [[package]] -name = "mdbook-trpl-listing" +name = "mdbook_trpl" version = "0.1.0" dependencies = [ "assert_cmd", @@ -503,22 +508,37 @@ dependencies = [ "pulldown-cmark-to-cmark", "serde_json", "thiserror", - "toml 0.8.13", + "toml 0.8.19", ] [[package]] name = "memchr" -version = "2.7.2" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "normpath" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8911957c4b1549ac0dc74e30db9c8b0e66ddcd6d7acc33098f4c63a64a6d7ed" +dependencies = [ + "windows-sys 0.59.0", +] + +[[package]] +name = "num-modular" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17bb261bf36fa7d83f4c294f834e91256769097b3cb505d44831e0a179ac647f" + +[[package]] +name = "num-order" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5831952a9476f2fed74b77d74182fa5ddc4d21c72ec45a333b250e3ed0272804" +checksum = "537b596b97c40fcf8056d153049eb22f481c17ebce72a513ec9286e4986d1bb6" dependencies = [ - "windows-sys 0.52.0", + "num-modular", ] [[package]] @@ -532,27 +552,27 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.19.0" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "opener" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8df34be653210fbe9ffaff41d3b92721c56ce82dfee58ee684f9afb5e3a90c0" +checksum = "d0812e5e4df08da354c851a3376fead46db31c2214f849d3de356d774d057681" dependencies = [ "bstr", "dbus", "normpath", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "pest" -version = "2.7.10" +version = "2.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "560131c633294438da9f7c4b08189194b20946c8274c6b9e38881a7874dc8ee8" +checksum = "879952a81a83930934cbf1786752d6dedc3b1f29e8f8fb2ad1d0a36f377cf442" dependencies = [ "memchr", "thiserror", @@ -561,9 +581,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.7.10" +version = "2.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26293c9193fbca7b1a3bf9b79dc1e388e927e6cacaa78b4a3ab705a1d3d41459" +checksum = "d214365f632b123a47fd913301e14c946c61d1c183ee245fa76eb752e59a02dd" dependencies = [ "pest", "pest_generator", @@ -571,9 +591,9 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.10" +version = "2.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ec22af7d3fb470a85dd2ca96b7c577a1eb4ef6f1683a9fe9a8c16e136c04687" +checksum = "eb55586734301717aea2ac313f50b2eb8f60d2fc3dc01d190eefa2e625f60c4e" dependencies = [ "pest", "pest_meta", @@ -584,9 +604,9 @@ dependencies = [ [[package]] name = "pest_meta" -version = "2.7.10" +version = "2.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7a240022f37c361ec1878d646fc5b7d7c4d28d5946e1a80ad5a7a4f4ca0bdcd" +checksum = "b75da2a70cf4d9cb76833c990ac9cd3923c9a8905a8929789ce347c84564d03d" dependencies = [ "once_cell", "pest", @@ -595,15 +615,15 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "predicates" -version = "3.1.0" +version = "3.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b87bfd4605926cdfefc1c3b5f8fe560e3feca9d5552cf68c466d3d8236c7e8" +checksum = "7e9086cc7640c29a356d1a29fd134380bee9d8f79a17410aa76e7ad295f42c97" dependencies = [ "anstyle", "difflib", @@ -612,15 +632,15 @@ dependencies = [ [[package]] name = "predicates-core" -version = "1.0.6" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b794032607612e7abeb4db69adb4e33590fa6cf1149e95fd7cb00e634b92f174" +checksum = "ae8177bee8e75d6846599c6b9ff679ed51e882816914eec639944d7c9aa11931" [[package]] name = "predicates-tree" -version = "1.0.9" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368ba315fb8c5052ab692e68a0eefec6ec57b23a36959c14496f0b0df2c0cecf" +checksum = "41b740d195ed3166cd147c8047ec98db0e22ec019eb8eeb76d343b795304fb13" dependencies = [ "predicates-core", "termtree", @@ -628,9 +648,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.83" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b33eb56c327dec362a9e55b3ad14f9d2f0904fb5a5b03b513ab5465399e9f43" +checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" dependencies = [ "unicode-ident", ] @@ -665,18 +685,18 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] [[package]] name = "regex" -version = "1.10.4" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", @@ -686,9 +706,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.6" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" +checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" dependencies = [ "aho-corasick", "memchr", @@ -697,15 +717,15 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.3" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "rustix" -version = "0.38.34" +version = "0.38.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +checksum = "375116bee2be9ed569afe2154ea6a99dfdffd257f533f187498c2a8f5feaf4ee" dependencies = [ "bitflags", "errno", @@ -722,18 +742,18 @@ checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "serde" -version = "1.0.202" +version = "1.0.214" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "226b61a0d411b2ba5ff6d7f73a476ac4f8bb900373459cd00fab8512828ba395" +checksum = "f55c3193aca71c12ad7890f1785d2b73e1b9f63a0bbc353c08ef26fe03fc56b5" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.202" +version = "1.0.214" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6048858004bcff69094cd972ed40a32500f153bd3be9f716b2eed2e8217c4838" +checksum = "de523f781f095e28fa605cdce0f8307e451cc0fd14e2eb4cd2e98a355b147766" dependencies = [ "proc-macro2", "quote", @@ -742,20 +762,21 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.117" +version = "1.0.132" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" +checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03" dependencies = [ "itoa", + "memchr", "ryu", "serde", ] [[package]] name = "serde_spanned" -version = "0.6.6" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" dependencies = [ "serde", ] @@ -785,9 +806,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" -version = "2.0.65" +version = "2.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2863d96a84c6439701d7a38f9de935ec562c8832cc55d1dde0f513b52fad106" +checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" dependencies = [ "proc-macro2", "quote", @@ -796,24 +817,25 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.10.1" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" +checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" dependencies = [ "cfg-if", "fastrand", + "once_cell", "rustix", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "terminal_size" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" +checksum = "4f599bd7ca042cfdf8f4512b277c02ba102247820f9d9d4a9f521f496751a6ef" dependencies = [ "rustix", - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] @@ -824,18 +846,18 @@ checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" [[package]] name = "thiserror" -version = "1.0.61" +version = "1.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" +checksum = "02dd99dc800bbb97186339685293e1cc5d9df1f8fae2d0aecd9ff1c77efea892" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.61" +version = "1.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" +checksum = "a7c61ec9a6f64d2793d8a45faba21efbe3ced62a886d44c36a009b2b519b4c7e" dependencies = [ "proc-macro2", "quote", @@ -853,9 +875,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.13" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4e43f8cc456c9704c851ae29c67e17ef65d2c30017c17a9765b89c382dc8bba" +checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" dependencies = [ "serde", "serde_spanned", @@ -865,18 +887,18 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.6" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.22.13" +version = "0.22.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c127785850e8c20836d49732ae6abfa47616e60bf9d9f57c43c250361a9db96c" +checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ "indexmap", "serde", @@ -899,42 +921,39 @@ checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "ucd-trie" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" [[package]] name = "unicase" -version = "2.7.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" -dependencies = [ - "version_check", -] +checksum = "7e51b68083f157f853b6379db119d1c1be0e6e4dec98101079dec41f6f5cf6df" [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unicode-width" -version = "0.1.12" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f5e5f3158ecfd4b8ff6fe086db7c8467a2dfdac97fe420f2b7c4aa97af66d6" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" [[package]] name = "utf8parse" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "version_check" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "wait-timeout" @@ -947,19 +966,20 @@ dependencies = [ [[package]] name = "wasm-bindgen" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" dependencies = [ "cfg-if", + "once_cell", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" dependencies = [ "bumpalo", "log", @@ -972,9 +992,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -982,9 +1002,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", @@ -995,9 +1015,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" +checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" [[package]] name = "winapi" @@ -1027,16 +1047,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.52.5", -] - -[[package]] -name = "windows-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets 0.48.5", + "windows-targets", ] [[package]] @@ -1045,135 +1056,87 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.5", + "windows-targets", ] [[package]] -name = "windows-targets" -version = "0.48.5" +name = "windows-sys" +version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ - "windows_aarch64_gnullvm 0.48.5", - "windows_aarch64_msvc 0.48.5", - "windows_i686_gnu 0.48.5", - "windows_i686_msvc 0.48.5", - "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm 0.48.5", - "windows_x86_64_msvc 0.48.5", + "windows-targets", ] [[package]] name = "windows-targets" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm 0.52.5", - "windows_aarch64_msvc 0.52.5", - "windows_i686_gnu 0.52.5", + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", "windows_i686_gnullvm", - "windows_i686_msvc 0.52.5", - "windows_x86_64_gnu 0.52.5", - "windows_x86_64_gnullvm 0.52.5", - "windows_x86_64_msvc 0.52.5", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", ] [[package]] name = "windows_aarch64_gnullvm" -version = "0.48.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" -version = "0.48.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" -version = "0.48.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" [[package]] name = "windows_i686_gnullvm" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" - -[[package]] -name = "windows_i686_msvc" -version = "0.48.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" -version = "0.48.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" -version = "0.48.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.6.8" +version = "0.6.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c52e9c97a68071b23e836c9380edae937f17b9c4667bd021973efc689f618d" +checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" dependencies = [ "memchr", ] diff --git a/packages/mdbook-trpl-listing/Cargo.toml b/packages/mdbook_trpl/Cargo.toml similarity index 84% rename from packages/mdbook-trpl-listing/Cargo.toml rename to packages/mdbook_trpl/Cargo.toml index 4b90001e23..84c478abae 100644 --- a/packages/mdbook-trpl-listing/Cargo.toml +++ b/packages/mdbook_trpl/Cargo.toml @@ -1,9 +1,15 @@ [package] -name = "mdbook-trpl-listing" +name = "mdbook_trpl" version = "0.1.0" edition = "2021" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[[bin]] +name = "mdbook-trpl-note" +path = "src/bin/note/main.rs" + +[[bin]] +name = "mdbook-trpl-listing" +path = "src/bin/listing/main.rs" [dependencies] clap = { version = "4", features = ["derive"] } diff --git a/packages/mdbook_trpl/README.md b/packages/mdbook_trpl/README.md new file mode 100644 index 0000000000..dd7d1ffbd4 --- /dev/null +++ b/packages/mdbook_trpl/README.md @@ -0,0 +1,13 @@ +# mdbook_trpl + +A shared package for [mdbook][] [preprocessors][pre] used in [_The Rust +Programming Language_][trpl]. + +Supplies the following preprocessor binaries: + +- [mdbook-trpl-note](./src/bin/note) +- [mdbook-trpl-listing](./src/bin/listing) + +[mdbook]: https://crates.io/crates/mdbook +[pre]: https://rust-lang.github.io/mdBook/format/configuration/preprocessors.html +[trpl]: https://doc.rust-lang.org/book/ diff --git a/packages/mdbook-trpl-listing/src/main.rs b/packages/mdbook_trpl/src/bin/listing/main.rs similarity index 75% rename from packages/mdbook-trpl-listing/src/main.rs rename to packages/mdbook_trpl/src/bin/listing/main.rs index 3792b46fa4..ed3f7226db 100644 --- a/packages/mdbook-trpl-listing/src/main.rs +++ b/packages/mdbook_trpl/src/bin/listing/main.rs @@ -3,20 +3,21 @@ use std::io; use clap::{self, Parser, Subcommand}; use mdbook::preprocess::{CmdPreprocessor, Preprocessor}; -use mdbook_trpl_listing::TrplListing; +use mdbook_trpl::Listing; fn main() -> Result<(), String> { let cli = Cli::parse(); if let Some(Command::Supports { renderer }) = cli.command { - return if TrplListing.supports_renderer(&renderer) { + return if Listing.supports_renderer(&renderer) { Ok(()) } else { Err(format!("Renderer '{renderer}' is unsupported")) }; } - let (ctx, book) = CmdPreprocessor::parse_input(io::stdin()).map_err(|e| format!("{e}"))?; - let processed = TrplListing.run(&ctx, book).map_err(|e| format!("{e}"))?; + let (ctx, book) = CmdPreprocessor::parse_input(io::stdin()) + .map_err(|e| format!("{e}"))?; + let processed = Listing.run(&ctx, book).map_err(|e| format!("{e}"))?; serde_json::to_writer(io::stdout(), &processed).map_err(|e| format!("{e}")) } diff --git a/packages/mdbook-trpl-note/README.md b/packages/mdbook_trpl/src/bin/note/README.md similarity index 100% rename from packages/mdbook-trpl-note/README.md rename to packages/mdbook_trpl/src/bin/note/README.md diff --git a/packages/mdbook-trpl-note/src/main.rs b/packages/mdbook_trpl/src/bin/note/main.rs similarity index 84% rename from packages/mdbook-trpl-note/src/main.rs rename to packages/mdbook_trpl/src/bin/note/main.rs index 8649432f82..8af222b8d2 100644 --- a/packages/mdbook-trpl-note/src/main.rs +++ b/packages/mdbook_trpl/src/bin/note/main.rs @@ -3,11 +3,11 @@ use std::io; use clap::{self, Parser, Subcommand}; use mdbook::preprocess::{CmdPreprocessor, Preprocessor}; -use mdbook_trpl_note::TrplNote; +use mdbook_trpl::Note; fn main() -> Result<(), String> { let cli = Cli::parse(); - let simple_note = TrplNote; + let simple_note = Note; if let Some(Command::Supports { renderer }) = cli.command { return if simple_note.supports_renderer(&renderer) { Ok(()) @@ -16,8 +16,8 @@ fn main() -> Result<(), String> { }; } - let (ctx, book) = - CmdPreprocessor::parse_input(io::stdin()).map_err(|e| format!("blah: {e}"))?; + let (ctx, book) = CmdPreprocessor::parse_input(io::stdin()) + .map_err(|e| format!("blah: {e}"))?; let processed = simple_note.run(&ctx, book).map_err(|e| format!("{e}"))?; serde_json::to_writer(io::stdout(), &processed).map_err(|e| format!("{e}")) } diff --git a/packages/mdbook_trpl/src/config/mod.rs b/packages/mdbook_trpl/src/config/mod.rs new file mode 100644 index 0000000000..bd28abab69 --- /dev/null +++ b/packages/mdbook_trpl/src/config/mod.rs @@ -0,0 +1,70 @@ +//! Get any `preprocessor.trpl` config. + +use mdbook::preprocess::PreprocessorContext; + +#[derive(Debug, Clone, Copy)] +pub enum Mode { + Default, + Simple, +} + +impl Mode { + pub fn from_context( + ctx: &PreprocessorContext, + preprocessor_name: &str, + ) -> Result { + let config = ctx + .config + .get_preprocessor(preprocessor_name) + .ok_or_else(|| Error::NoConfig(preprocessor_name.into()))?; + + let key = String::from("output-mode"); + let mode = config + .get(&key) + .map(|value| match value.as_str() { + Some(s) => Mode::try_from(s).map_err(|_| Error::BadValue { + key, + value: value.to_string(), + }), + None => Err(Error::BadValue { + key, + value: value.to_string(), + }), + }) + .transpose()? + .unwrap_or(Mode::Default); + Ok(mode) + } +} + +/// Trivial marker struct to indicate an internal error. +/// +/// The caller has enough info to do what it needs without passing data around. +pub struct ParseErr; + +impl TryFrom<&str> for Mode { + type Error = ParseErr; + + fn try_from(value: &str) -> std::prelude::v1::Result { + match value { + "default" => Ok(Mode::Default), + "simple" => Ok(Mode::Simple), + _ => Err(ParseErr), + } + } +} + +#[derive(Debug, thiserror::Error)] +pub enum Error { + #[error(transparent)] + Mdbook(mdbook::errors::Error), + + #[error("No config for '{0}'")] + NoConfig(String), + + #[error("Bad config value '{value}' for key '{key}'")] + BadValue { key: String, value: String }, +} + +#[cfg(test)] +mod tests; diff --git a/packages/mdbook-trpl-listing/src/tests/config.rs b/packages/mdbook_trpl/src/config/tests.rs similarity index 62% rename from packages/mdbook-trpl-listing/src/tests/config.rs rename to packages/mdbook_trpl/src/config/tests.rs index d44004b3e2..0795595abc 100644 --- a/packages/mdbook-trpl-listing/src/tests/config.rs +++ b/packages/mdbook_trpl/src/config/tests.rs @@ -6,96 +6,118 @@ //! more complex in the future, it would be good to revisit and integrate //! the same kinds of tests as the unit tests above here. -use super::*; +use mdbook::{ + book::Book, + errors::Result, + preprocess::{Preprocessor, PreprocessorContext}, + BookItem, +}; + +use crate::config::Mode; + +/// Dummy preprocessor for testing purposes to exercise config. +struct TestPreprocessor; + +impl Preprocessor for TestPreprocessor { + fn name(&self) -> &str { + "test-preprocessor" + } + + fn run(&self, ctx: &PreprocessorContext, mut book: Book) -> Result { + let mode = Mode::from_context(ctx, self.name())?; + book.push_item(BookItem::PartTitle(format!("{mode:?}"))); + Ok(book) + } +} -// TODO: what *should* the behavior here be? I *think* it should error, -// in that there is a problem if it is invoked without that info. #[test] fn no_config() { let input_json = r##"[ - { - "root": "/path/to/book", - "config": { - "book": { - "authors": ["AUTHOR"], - "language": "en", - "multilingual": false, - "src": "src", - "title": "TITLE" - }, - "preprocessor": {} - }, - "renderer": "html", - "mdbook_version": "0.4.21" + { + "root": "/path/to/book", + "config": { + "book": { + "authors": ["AUTHOR"], + "language": "en", + "multilingual": false, + "src": "src", + "title": "TITLE" }, + "preprocessor": {} + }, + "renderer": "html", + "mdbook_version": "0.4.21" + }, + { + "sections": [ { - "sections": [ - { - "Chapter": { - "name": "Chapter 1", - "content": "# Chapter 1\n", - "number": [1], - "sub_items": [], - "path": "chapter_1.md", - "source_path": "chapter_1.md", - "parent_names": [] - } - } - ], - "__non_exhaustive": null + "Chapter": { + "name": "Chapter 1", + "content": "# Chapter 1\n", + "number": [1], + "sub_items": [], + "path": "chapter_1.md", + "source_path": "chapter_1.md", + "parent_names": [] + } } - ]"##; + ], + "__non_exhaustive": null + } + ]"##; let input_json = input_json.as_bytes(); let (ctx, book) = mdbook::preprocess::CmdPreprocessor::parse_input(input_json).unwrap(); - let result = TrplListing.run(&ctx, book); + let result = TestPreprocessor.run(&ctx, book); assert!(result.is_err()); let err = result.unwrap_err(); - assert_eq!(format!("{err}"), "No config for trpl-listing"); + assert_eq!(format!("{err}"), "No config for 'test-preprocessor'"); } #[test] fn empty_config() { let input_json = r##"[ - { - "root": "/path/to/book", - "config": { - "book": { - "authors": ["AUTHOR"], - "language": "en", - "multilingual": false, - "src": "src", - "title": "TITLE" - }, - "preprocessor": { - "trpl-listing": {} - } - }, - "renderer": "html", - "mdbook_version": "0.4.21" + { + "root": "/path/to/book", + "config": { + "book": { + "authors": ["AUTHOR"], + "language": "en", + "multilingual": false, + "src": "src", + "title": "TITLE" }, + "preprocessor": { + "test-preprocessor": {} + } + }, + "renderer": "html", + "mdbook_version": "0.4.21" + }, + { + "sections": [ { - "sections": [ - { - "Chapter": { - "name": "Chapter 1", - "content": "# Chapter 1\n", - "number": [1], - "sub_items": [], - "path": "chapter_1.md", - "source_path": "chapter_1.md", - "parent_names": [] - } - } - ], - "__non_exhaustive": null + "Chapter": { + "name": "Chapter 1", + "content": "# Chapter 1\n", + "number": [1], + "sub_items": [], + "path": "chapter_1.md", + "source_path": "chapter_1.md", + "parent_names": [] + } } - ]"##; + ], + "__non_exhaustive": null + } + ]"##; let input_json = input_json.as_bytes(); let (ctx, book) = mdbook::preprocess::CmdPreprocessor::parse_input(input_json).unwrap(); - let result = TrplListing.run(&ctx, book); - assert!(result.is_ok()); + let book = TestPreprocessor.run(&ctx, book).unwrap(); + assert!(book.iter().any( + |item| matches!(item, BookItem::PartTitle(title) if title == &format!("{:?}", Mode::Default)) + )) } #[test] @@ -112,7 +134,7 @@ fn specify_default() { "title": "TITLE" }, "preprocessor": { - "trpl-listing": { + "test-preprocessor": { "output-mode": "default" } } @@ -140,8 +162,10 @@ fn specify_default() { let input_json = input_json.as_bytes(); let (ctx, book) = mdbook::preprocess::CmdPreprocessor::parse_input(input_json).unwrap(); - let result = TrplListing.run(&ctx, book); - assert!(result.is_ok()); + let book = TestPreprocessor.run(&ctx, book).unwrap(); + assert!(book.iter().any( + |item| matches!(item, BookItem::PartTitle(title) if title == &format!("{:?}", Mode::Default)) + )); } #[test] @@ -158,7 +182,7 @@ fn specify_simple() { "title": "TITLE" }, "preprocessor": { - "trpl-listing": { + "test-preprocessor": { "output-mode": "simple" } } @@ -186,8 +210,10 @@ fn specify_simple() { let input_json = input_json.as_bytes(); let (ctx, book) = mdbook::preprocess::CmdPreprocessor::parse_input(input_json).unwrap(); - let result = TrplListing.run(&ctx, book); - assert!(result.is_ok()); + let book = TestPreprocessor.run(&ctx, book).unwrap(); + assert!(book.iter().any( + |item| matches!(item, BookItem::PartTitle(title) if title == &format!("{:?}", Mode::Simple)) + )) } #[test] @@ -204,7 +230,7 @@ fn specify_invalid() { "title": "TITLE" }, "preprocessor": { - "trpl-listing": { + "test-preprocessor": { "output-mode": "nonsense" } } @@ -232,11 +258,9 @@ fn specify_invalid() { let input_json = input_json.as_bytes(); let (ctx, book) = mdbook::preprocess::CmdPreprocessor::parse_input(input_json).unwrap(); - let result = TrplListing.run(&ctx, book); - assert!(result.is_err()); - let err = result.unwrap_err(); + let result = TestPreprocessor.run(&ctx, book).unwrap_err(); assert_eq!( - format!("{err}"), + format!("{result}"), "Bad config value '\"nonsense\"' for key 'output-mode'" ); } diff --git a/packages/mdbook_trpl/src/lib.rs b/packages/mdbook_trpl/src/lib.rs new file mode 100644 index 0000000000..806283e417 --- /dev/null +++ b/packages/mdbook_trpl/src/lib.rs @@ -0,0 +1,6 @@ +pub mod config; +mod listing; +mod note; + +pub use listing::TrplListing as Listing; +pub use note::TrplNote as Note; diff --git a/packages/mdbook-trpl-listing/src/lib.rs b/packages/mdbook_trpl/src/listing/mod.rs similarity index 87% rename from packages/mdbook-trpl-listing/src/lib.rs rename to packages/mdbook_trpl/src/listing/mod.rs index c4ff14e447..230f389d1b 100644 --- a/packages/mdbook-trpl-listing/src/lib.rs +++ b/packages/mdbook_trpl/src/listing/mod.rs @@ -9,6 +9,8 @@ use mdbook::{ use pulldown_cmark::{html, Event}; use pulldown_cmark_to_cmark::cmark; +use crate::config::Mode; + /// A preprocessor for rendering listings more elegantly. /// /// Given input like this: @@ -59,26 +61,7 @@ impl Preprocessor for TrplListing { } fn run(&self, ctx: &PreprocessorContext, mut book: Book) -> Result { - let config = ctx - .config - .get_preprocessor(self.name()) - .ok_or(Error::NoConfig)?; - - let key = String::from("output-mode"); - let mode = config - .get(&key) - .map(|value| match value.as_str() { - Some(s) => Mode::try_from(s).map_err(|_| Error::BadValue { - key, - value: value.to_string(), - }), - None => Err(Error::BadValue { - key, - value: value.to_string(), - }), - }) - .transpose()? - .unwrap_or(Mode::Default); + let mode = Mode::from_context(ctx, self.name())?; let mut errors: Vec = vec![]; book.for_each_mut(|item| { @@ -102,42 +85,10 @@ impl Preprocessor for TrplListing { } } -#[derive(Debug, thiserror::Error)] -enum Error { - #[error("No config for trpl-listing")] - NoConfig, - - #[error("Bad config value '{value}' for key '{key}'")] - BadValue { key: String, value: String }, -} - #[derive(Debug, thiserror::Error)] #[error("Error(s) rewriting input: {0}")] struct CompositeError(String); -#[derive(Debug, Clone, Copy)] -enum Mode { - Default, - Simple, -} - -/// Trivial marker struct to indicate an internal error. -/// -/// The caller has enough info to do what it needs without passing data around. -struct ParseErr; - -impl TryFrom<&str> for Mode { - type Error = ParseErr; - - fn try_from(value: &str) -> std::prelude::v1::Result { - match value { - "default" => Ok(Mode::Default), - "simple" => Ok(Mode::Simple), - _ => Err(ParseErr), - } - } -} - fn rewrite_listing(src: &str, mode: Mode) -> Result { let final_state = new_cmark_parser(src, true).try_fold( ListingState { diff --git a/packages/mdbook-trpl-listing/src/tests/mod.rs b/packages/mdbook_trpl/src/listing/tests.rs similarity index 98% rename from packages/mdbook-trpl-listing/src/tests/mod.rs rename to packages/mdbook_trpl/src/listing/tests.rs index 224b14fe50..af67142d12 100644 --- a/packages/mdbook-trpl-listing/src/tests/mod.rs +++ b/packages/mdbook_trpl/src/listing/tests.rs @@ -287,9 +287,3 @@ fn main() {} ) } } - -#[test] -fn missing_value() {} - -#[cfg(test)] -mod config; diff --git a/packages/mdbook_trpl/src/note/mod.rs b/packages/mdbook_trpl/src/note/mod.rs new file mode 100644 index 0000000000..3f6a46d6be --- /dev/null +++ b/packages/mdbook_trpl/src/note/mod.rs @@ -0,0 +1,150 @@ +use mdbook::{ + book::Book, + errors::Result, + preprocess::{Preprocessor, PreprocessorContext}, + utils::new_cmark_parser, + BookItem, +}; +use pulldown_cmark::{ + Event::{self, *}, + Tag, TagEnd, +}; +use pulldown_cmark_to_cmark::cmark; + +/// A simple preprocessor for semantic notes in _The Rust Programming Language_. +/// +/// Takes in Markdown like this: +/// +/// ```markdown +/// > Note: This is a note. +/// ``` +/// +/// Spits out Markdown like this: +/// +/// ```markdown +///
+/// +/// This is a note. +/// +///
+/// ``` +pub struct TrplNote; + +impl Preprocessor for TrplNote { + fn name(&self) -> &str { + "simple-note-preprocessor" + } + + fn run( + &self, + _ctx: &PreprocessorContext, + mut book: Book, + ) -> Result { + book.for_each_mut(|item| { + if let BookItem::Chapter(ref mut chapter) = item { + chapter.content = rewrite(&chapter.content); + } + }); + Ok(book) + } + + fn supports_renderer(&self, renderer: &str) -> bool { + renderer == "html" || renderer == "markdown" || renderer == "test" + } +} + +pub fn rewrite(text: &str) -> String { + let parser = new_cmark_parser(text, true); + + let mut events = Vec::new(); + let mut state = Default; + + for event in parser { + match (&mut state, event) { + (Default, Start(Tag::BlockQuote)) => { + state = StartingBlockquote(vec![Start(Tag::BlockQuote)]); + } + + (StartingBlockquote(blockquote_events), Text(content)) => { + if content.starts_with("Note: ") { + // This needs the "extra" `SoftBreak`s so that when the final rendering pass + // happens, it does not end up treating the internal content as inline *or* + // treating the HTML tags as inline tags: + // + // - Content inside HTML blocks is only rendered as Markdown when it is + // separated from the block HTML elements: otherwise it gets treated as inline + // HTML and *not* rendered. + // - Along the same lines, an HTML tag that happens to be directly adjacent to + // the end of a previous Markdown block will end up being rendered as part of + // that block. + events.extend([ + SoftBreak, + SoftBreak, + Html( + r#"
"#.into(), + ), + SoftBreak, + SoftBreak, + Start(Tag::Paragraph), + Text(content), + ]); + state = InNote; + } else { + events.append(blockquote_events); + events.push(Text(content)); + state = Default; + } + } + + ( + StartingBlockquote(_blockquote_events), + heading @ Start(Tag::Heading { .. }), + ) => { + events.extend([ + SoftBreak, + SoftBreak, + Html(r#"
"#.into()), + SoftBreak, + SoftBreak, + heading, + ]); + state = InNote; + } + + (StartingBlockquote(ref mut events), Start(tag)) => { + events.push(Start(tag)); + } + + (InNote, End(TagEnd::BlockQuote)) => { + // As with the start of the block HTML, the closing HTML must be + // separated from the Markdown text by two newlines. + events.extend([ + SoftBreak, + SoftBreak, + Html("
".into()), + ]); + state = Default; + } + + (_, event) => { + events.push(event); + } + } + } + + let mut buf = String::new(); + cmark(events.into_iter(), &mut buf).unwrap(); + buf +} + +use State::*; + +#[derive(Debug)] +enum State<'e> { + Default, + StartingBlockquote(Vec>), + InNote, +} + +#[cfg(test)] +mod tests; diff --git a/packages/mdbook_trpl/src/note/tests.rs b/packages/mdbook_trpl/src/note/tests.rs new file mode 100644 index 0000000000..2927b507ca --- /dev/null +++ b/packages/mdbook_trpl/src/note/tests.rs @@ -0,0 +1,195 @@ +use super::*; + +#[test] +fn no_note() { + let text = "Hello, world.\n\nThis is some text."; + let processed = rewrite(text); + assert_eq!( + render_markdown(&processed), + "

Hello, world.

\n

This is some text.

\n" + ); +} + +#[test] +fn with_note() { + let text = "> Note: This is some text.\n> It keeps going."; + let processed = rewrite(text); + assert_eq!( + render_markdown(&processed), + "
\n

Note: This is some text.\nIt keeps going.

\n
" + ); +} + +#[test] +fn regular_blockquote() { + let text = "> This is some text.\n> It keeps going."; + let processed = rewrite(text); + assert_eq!( + render_markdown(&processed), + "
\n

This is some text.\nIt keeps going.

\n
\n" + ); +} + +#[test] +fn combined() { + let text = "> Note: This is some text.\n> It keeps going.\n\nThis is regular text.\n\n> This is a blockquote.\n"; + let processed = rewrite(text); + assert_eq!( + render_markdown(&processed), + "
\n

Note: This is some text.\nIt keeps going.

\n
\n

This is regular text.

\n
\n

This is a blockquote.

\n
\n" + ); +} + +#[test] +fn blockquote_then_note() { + let text = "> This is quoted.\n\n> Note: This is noted."; + let processed = rewrite(text); + assert_eq!( + render_markdown(&processed), + "
\n

This is quoted.

\n
\n
\n

Note: This is noted.

\n
" + ); +} + +#[test] +fn note_then_blockquote() { + let text = "> Note: This is noted.\n\n> This is quoted."; + let processed = rewrite(text); + assert_eq!( + render_markdown(&processed), + "
\n

Note: This is noted.

\n
\n
\n

This is quoted.

\n
\n" + ); +} + +#[test] +fn with_h1_note() { + let text = "> # Header\n > And then some note content."; + let processed = rewrite(text); + assert_eq!( + render_markdown(&processed), + "
\n

Header

\n

And then some note content.

\n
" + ); +} + +#[test] +fn with_h2_note() { + let text = "> ## Header\n > And then some note content."; + let processed = rewrite(text); + assert_eq!( + render_markdown(&processed), + "
\n

Header

\n

And then some note content.

\n
" + ); +} + +#[test] +fn with_h3_note() { + let text = "> ### Header\n > And then some note content."; + let processed = rewrite(text); + assert_eq!( + render_markdown(&processed), + "
\n

Header

\n

And then some note content.

\n
" + ); +} + +#[test] +fn with_h4_note() { + let text = "> #### Header\n > And then some note content."; + let processed = rewrite(text); + assert_eq!( + render_markdown(&processed), + "
\n

Header

\n

And then some note content.

\n
" + ); +} + +#[test] +fn with_h5_note() { + let text = "> ##### Header\n > And then some note content."; + let processed = rewrite(text); + assert_eq!( + render_markdown(&processed), + "
\n
Header
\n

And then some note content.

\n
" + ); +} + +#[test] +fn with_h6_note() { + let text = "> ###### Header\n > And then some note content."; + let processed = rewrite(text); + assert_eq!( + render_markdown(&processed), + "
\n
Header
\n

And then some note content.

\n
" + ); +} + +#[test] +fn h1_then_blockquote() { + let text = + "> # Header\n > And then some note content.\n\n> This is quoted."; + let processed = rewrite(text); + assert_eq!( + render_markdown(&processed), + "
\n

Header

\n

And then some note content.

\n
\n
\n

This is quoted.

\n
\n" + ); +} + +#[test] +fn blockquote_then_h1_note() { + let text = + "> This is quoted.\n\n> # Header\n > And then some note content."; + let processed = rewrite(text); + assert_eq!( + render_markdown(&processed), + "
\n

This is quoted.

\n
\n
\n

Header

\n

And then some note content.

\n
" + ); +} + +#[test] +fn blockquote_with_strong() { + let text = "> **Bold text in a paragraph.**"; + let processed = rewrite(text); + assert_eq!( + render_markdown(&processed), + "
\n

Bold text in a paragraph.

\n
\n" + ); +} + +#[test] +fn normal_table() { + let text = "| Header 1 | Header 2 |\n| -------- | -------- |\n| Text 123 | More 456 |"; + let processed = rewrite(text); + + assert_eq!( + processed, + "|Header 1|Header 2|\n|--------|--------|\n|Text 123|More 456|", + "It strips some whitespace but otherwise leaves the table intact." + ); +} + +#[test] +fn table_in_note() { + let text = "> Note: table stuff.\n\n| Header 1 | Header 2 |\n| -------- | -------- |\n| Text 123 | More 456 |"; + let processed = rewrite(text); + + assert_eq!( + processed, + "\n\n
\n\nNote: table stuff.\n\n
\n\n|Header 1|Header 2|\n|--------|--------|\n|Text 123|More 456|", + "It adds the note markup but leaves the table untouched, to be rendered as Markdown." + ); +} + +#[test] +fn table_in_quote() { + let text = "> A table.\n\n| Header 1 | Header 2 |\n| -------- | -------- |\n| Text 123 | More 456 |"; + let processed = rewrite(text); + assert_eq!( + render_markdown(&processed), + "
\n

A table.

\n
\n\n\n
Header 1Header 2
Text 123More 456
\n", + "It renders blockquotes with nested tables as expected." + ); +} + +fn render_markdown(text: &str) -> String { + let parser = new_cmark_parser(text, true); + let mut buf = String::new(); + pulldown_cmark::html::push_html(&mut buf, parser); + buf +} diff --git a/packages/mdbook_trpl/tests/integration/main.rs b/packages/mdbook_trpl/tests/integration/main.rs new file mode 100644 index 0000000000..bc081a1204 --- /dev/null +++ b/packages/mdbook_trpl/tests/integration/main.rs @@ -0,0 +1,20 @@ +mod note { + use assert_cmd::Command; + #[test] + fn supports_html_renderer() { + let cmd = Command::cargo_bin("mdbook-trpl-note") + .unwrap() + .args(["supports", "html"]) + .ok(); + assert!(cmd.is_ok()); + } + + #[test] + fn errors_for_other_renderers() { + let cmd = Command::cargo_bin("mdbook-trpl-note") + .unwrap() + .args(["supports", "total-nonsense"]) + .ok(); + assert!(cmd.is_err()); + } +}