Skip to content

Commit

Permalink
[localization] rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruin0x11 committed Sep 15, 2021
1 parent 92ec3dd commit 56e72a2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
10 changes: 8 additions & 2 deletions src/book/book.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,20 @@ fn load_single_book_translation<P: AsRef<Path>>(

let mut summary_content = String::new();
File::open(&summary_md)
.with_context(|| format!("Couldn't open SUMMARY.md in {:?} directory", localized_src_dir))?
.with_context(|| {
format!(
"Couldn't open SUMMARY.md in {:?} directory",
localized_src_dir
)
})?
.read_to_string(&mut summary_content)?;

let summary = parse_summary(&summary_content)
.with_context(|| format!("Summary parsing failed for file={:?}", summary_md))?;

if cfg.build.create_missing {
create_missing(&localized_src_dir, &summary).with_context(|| "Unable to create missing chapters")?;
create_missing(&localized_src_dir, &summary)
.with_context(|| "Unable to create missing chapters")?;
}

load_book_from_disk(&summary, localized_src_dir, fallback_src_dir, cfg)
Expand Down
11 changes: 9 additions & 2 deletions src/preprocess/links.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,14 @@ impl Preprocessor for LinkPreprocessor {
let fallback = fallback_src_dir.join(parent);

let mut chapter_title = ch.name.clone();
let content = replace_all(&ch.content, base, Some(fallback), chapter_path, 0, &mut chapter_title);
let content = replace_all(
&ch.content,
base,
Some(fallback),
chapter_path,
0,
&mut chapter_title,
);
ch.content = content;
if chapter_title != ch.name {
ctx.chapter_titles
Expand All @@ -83,7 +90,7 @@ fn replace_all<P1, P2>(
fallback: Option<P1>,
source: P2,
depth: usize,
chapter_title: &mut String
chapter_title: &mut String,
) -> String
where
P1: AsRef<Path>,
Expand Down

0 comments on commit 56e72a2

Please sign in to comment.