[localization] rustfmt
This commit is contained in:
parent
92ec3ddc55
commit
56e72a2238
@ -55,14 +55,20 @@ fn load_single_book_translation<P: AsRef<Path>>(
|
|||||||
|
|
||||||
let mut summary_content = String::new();
|
let mut summary_content = String::new();
|
||||||
File::open(&summary_md)
|
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)?;
|
.read_to_string(&mut summary_content)?;
|
||||||
|
|
||||||
let summary = parse_summary(&summary_content)
|
let summary = parse_summary(&summary_content)
|
||||||
.with_context(|| format!("Summary parsing failed for file={:?}", summary_md))?;
|
.with_context(|| format!("Summary parsing failed for file={:?}", summary_md))?;
|
||||||
|
|
||||||
if cfg.build.create_missing {
|
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)
|
load_book_from_disk(&summary, localized_src_dir, fallback_src_dir, cfg)
|
||||||
|
@ -62,7 +62,14 @@ impl Preprocessor for LinkPreprocessor {
|
|||||||
let fallback = fallback_src_dir.join(parent);
|
let fallback = fallback_src_dir.join(parent);
|
||||||
|
|
||||||
let mut chapter_title = ch.name.clone();
|
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;
|
ch.content = content;
|
||||||
if chapter_title != ch.name {
|
if chapter_title != ch.name {
|
||||||
ctx.chapter_titles
|
ctx.chapter_titles
|
||||||
@ -83,7 +90,7 @@ fn replace_all<P1, P2>(
|
|||||||
fallback: Option<P1>,
|
fallback: Option<P1>,
|
||||||
source: P2,
|
source: P2,
|
||||||
depth: usize,
|
depth: usize,
|
||||||
chapter_title: &mut String
|
chapter_title: &mut String,
|
||||||
) -> String
|
) -> String
|
||||||
where
|
where
|
||||||
P1: AsRef<Path>,
|
P1: AsRef<Path>,
|
||||||
|
Loading…
Reference in New Issue
Block a user