Skip to content

Commit 93597fd

Browse files
committed
Fix some issues with the rust-lang/rust upstream.
1 parent 047460f commit 93597fd

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

mdbook-spec/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## mdbook-spec 0.1.2
4+
5+
- Fixed some issues with rust-lang/rust build integration.
6+
37
## mdbook-spec 0.1.1
48

59
- Moved code to a library to support upstream integration.

mdbook-spec/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mdbook-spec"
3-
version = "0.1.1"
3+
version = "0.1.2"
44
edition = "2021"
55
license = "MIT OR Apache-2.0"
66
description = "An mdBook preprocessor to help with the Rust specification."
@@ -13,7 +13,7 @@ anyhow = "1.0.79"
1313
mdbook = { version = "0.4.36", default-features = false }
1414
once_cell = "1.19.0"
1515
pathdiff = "0.2.1"
16-
regex = "1.10.3"
16+
regex = "1.9.4"
1717
semver = "1.0.21"
1818
serde_json = "1.0.113"
1919
tempfile = "3.10.1"

mdbook-spec/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ impl Spec {
6565
let source_path = chapter.source_path.clone().unwrap_or_default();
6666
let path = chapter.path.clone().unwrap_or_default();
6767
RULE_RE
68-
.replace_all(&chapter.content, |caps: &Captures| {
68+
.replace_all(&chapter.content, |caps: &Captures<'_>| {
6969
let rule_id = &caps[1];
7070
if let Some((old, _)) =
7171
found_rules.insert(rule_id.to_string(), (source_path.clone(), path.clone()))
@@ -127,7 +127,7 @@ impl Spec {
127127
/// file.
128128
fn admonitions(&self, chapter: &Chapter) -> String {
129129
ADMONITION_RE
130-
.replace_all(&chapter.content, |caps: &Captures| {
130+
.replace_all(&chapter.content, |caps: &Captures<'_>| {
131131
let lower = caps["admon"].to_lowercase();
132132
format!(
133133
"<div class=\"{lower}\">\n\n{}\n\n</div>\n",
@@ -140,7 +140,7 @@ impl Spec {
140140

141141
impl Preprocessor for Spec {
142142
fn name(&self) -> &str {
143-
"nop-preprocessor"
143+
"spec"
144144
}
145145

146146
fn run(&self, _ctx: &PreprocessorContext, mut book: Book) -> Result<Book, Error> {

mdbook-spec/src/std_links.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ pub fn std_links(chapter: &Chapter) -> String {
7474

7575
// Replace any disambiguated links with just the disambiguation.
7676
let mut output = STD_LINK_RE
77-
.replace_all(&chapter.content, |caps: &Captures| {
77+
.replace_all(&chapter.content, |caps: &Captures<'_>| {
7878
if let Some(dest) = caps.get(2) {
7979
// Replace destination parenthesis with a link definition (square brackets).
8080
format!("{}[{}]", &caps[1], dest.as_str())
@@ -174,7 +174,8 @@ fn run_rustdoc(tmp: &TempDir, links: &[(&str, Option<&str>)], chapter: &Chapter)
174174
)
175175
.unwrap();
176176
fs::write(&src_path, &src).unwrap();
177-
let output = Command::new("rustdoc")
177+
let rustdoc = std::env::var("RUSTDOC").unwrap_or_else(|_| "rustdoc".into());
178+
let output = Command::new(rustdoc)
178179
.arg("--edition=2021")
179180
.arg(&src_path)
180181
.current_dir(tmp.path())

0 commit comments

Comments
 (0)