Skip to content

Commit fc9fd78

Browse files
committed
fix: update some dependencies into the code
1 parent cd5a9c9 commit fc9fd78

File tree

17 files changed

+52
-52
lines changed

17 files changed

+52
-52
lines changed

Cargo.lock

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ env_logger = "0.10.0"
2626
handlebars = "5.0"
2727
http = "0.2.4"
2828
log = "0.4.17"
29+
lazy_static = "1.0"
2930
memchr = "2.5.0"
3031
opener = "0.6.1"
3132
pulldown-cmark = { version = "0.9.3", default-features = false }

guide/src/en/guide/creating.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Creating a Book

guide/src/en/guide/installation.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Installation

guide/src/en/guide/reading.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Reading Books

src/book/mod.rs

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -346,19 +346,11 @@ impl MDBook {
346346
_ => continue,
347347
};
348348

349-
if let Some(chapter) = chapter {
350-
if ch.name != chapter && chapter_path.to_str() != Some(chapter) {
351-
if chapter == "?" {
352-
info!("Skipping chapter '{}'...", ch.name);
353-
}
354-
continue;
355-
}
356-
}
357-
chapter_found = true;
358-
info!("Testing chapter '{}': {:?}", ch.name, chapter_path);
349+
let path = self.source_dir().join(&chapter_path);
350+
info!("Testing file: {:?}", path);
359351

360352
// write preprocessed file to tempdir
361-
let path = temp_dir.path().join(chapter_path);
353+
let path = temp_dir.path().join(&chapter_path);
362354
let mut tmpf = utils::fs::create_file(&path)?;
363355
tmpf.write_all(ch.content.as_bytes())?;
364356

@@ -368,18 +360,17 @@ impl MDBook {
368360
if let Some(edition) = self.config.rust.edition {
369361
match edition {
370362
RustEdition::E2015 => {
371-
cmd.args(["--edition", "2015"]);
363+
cmd.args(&["--edition", "2015"]);
372364
}
373365
RustEdition::E2018 => {
374-
cmd.args(["--edition", "2018"]);
366+
cmd.args(&["--edition", "2018"]);
375367
}
376368
RustEdition::E2021 => {
377-
cmd.args(["--edition", "2021"]);
369+
cmd.args(&["--edition", "2021"]);
378370
}
379371
}
380372
}
381373

382-
debug!("running {:?}", cmd);
383374
let output = cmd.output()?;
384375

385376
if !output.status.success() {
@@ -396,11 +387,6 @@ impl MDBook {
396387
if failed {
397388
bail!("One or more tests failed");
398389
}
399-
if let Some(chapter) = chapter {
400-
if !chapter_found {
401-
bail!("Chapter not found: {}", chapter);
402-
}
403-
}
404390
Ok(())
405391
}
406392

src/build_opts.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//! Build options.
22
3+
use serde::{Deserialize, Serialize};
4+
35
/// Build options passed from the frontend to control how the book is built.
46
/// Separate from `Config`, which is global to all book languages.
57
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Default)]

src/cmd/build.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,16 @@ pub fn make_subcommand() -> Command {
1111
.arg_dest_dir()
1212
.arg_root_dir()
1313
.arg_open()
14-
.arg_from_usage(
15-
"-l, --language=[language] 'Language to render the compiled book in.{n}\
16-
Only valid if the [language] table in the config is not empty.{n}\
17-
If omitted, builds all translations and provides a menu in the generated output for switching between them.'",
18-
)
14+
.arg(Arg::new("language").short('l').long("language").num_args(1).value_parser(clap::value_parser!(String)).help("Language to render the compiled book in.{n}\
15+
Only valid if the [language] table in the config is not empty.{n}\
16+
If omitted, builds all translations and provides a menu in the generated output for switching between them."))
1917
}
2018

2119
// Build command implementation
2220
pub fn execute(args: &ArgMatches) -> Result<()> {
2321
let book_dir = get_book_dir(args);
2422
let opts = get_build_opts(args);
23+
println!("llegan {:?}", opts.language_ident);
2524
let mut book = MDBook::load_with_build_opts(&book_dir, opts)?;
2625

2726
if let Some(dest_dir) = args.get_one::<PathBuf>("dest-dir") {

src/cmd/clean.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@ pub fn make_subcommand() -> Command {
1111
.about("Deletes a built book")
1212
.arg_dest_dir()
1313
.arg_root_dir()
14-
.arg_from_usage(
15-
"-l, --language=[language] 'Language to render the compiled book in.{n}\
16-
Only valid if the [language] table in the config is not empty.{n}\
17-
If omitted, builds all translations and provides a menu in the generated output for switching between them.'",
18-
)
14+
.arg(Arg::new("language").short('l').long("language").num_args(1).value_parser(clap::value_parser!(String)).help("Language to render the compiled book in.{n}\
15+
Only valid if the [language] table in the config is not empty.{n}\
16+
If omitted, builds all translations and provides a menu in the generated output for switching between them."))
1917
}
2018

2119
// Clean command implementation

src/cmd/serve.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,9 @@ pub fn make_subcommand() -> Command {
4444
.help("Port to use for HTTP connections"),
4545
)
4646
.arg_open()
47-
.arg_from_usage(
48-
"-l, --language=[language] 'Language to render the compiled book in.{n}\
49-
Only valid if the [language] table in the config is not empty.{n}\
50-
If omitted, builds all translations and provides a menu in the generated output for switching between them.'",
51-
)
47+
.arg(Arg::new("language").short('l').long("language").num_args(1).value_parser(clap::value_parser!(String)).help("Language to render the compiled book in.{n}\
48+
Only valid if the [language] table in the config is not empty.{n}\
49+
If omitted, builds all translations and provides a menu in the generated output for switching between them."))
5250
}
5351

5452
// Serve command implementation

0 commit comments

Comments
 (0)