Skip to content

Commit

Permalink
feat: support src in i18n and set BASE_OUT_DIR = "html"
Browse files Browse the repository at this point in the history
  • Loading branch information
chunshao90 committed Feb 1, 2023
1 parent 24c251d commit 23c364c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mdbook-i18n"
version = "0.1.2"
version = "0.1.3"
authors = ["funkill2 <[email protected]>"]
edition = "2018"
exclude = ["/examples/*", '/.dependabot/*']
Expand Down
14 changes: 9 additions & 5 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use std::{
use toml::value::Table;
use toml::Value;

const BASE_OUT_DIR: &str = "i18n";
const BASE_OUT_DIR: &str = "html";

#[derive(Debug)]
pub(crate) struct RenderConfig(pub(crate) Vec<RenderItem>);
Expand Down Expand Up @@ -44,13 +44,17 @@ impl TryFrom<RenderContext> for RenderConfig {
.as_str()
.expect("Language for one of translations not a string"),
);
let src = String::from(
table
.get("src")
.expect("Not found for one of translations")
.as_str()
.expect("Language for one of translations not a string"),
);
let book = {
let mut book: BookConfig =
Value::Table(table).try_into().expect("Can't parse config");
if book.src.as_os_str() == "src" {
book.src = PathBuf::from("translations");
book.src.push(language.clone());
}
book.src = PathBuf::from(src);

book
};
Expand Down

0 comments on commit 23c364c

Please sign in to comment.