From 683d2b224073fe346ba0fdf51b237a07e4c4fdfd Mon Sep 17 00:00:00 2001 From: toyboot4e Date: Sun, 3 May 2020 17:54:17 +0900 Subject: [PATCH] Fix use of MDBOOK_BOOK --- src/config.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/config.rs b/src/config.rs index 36190ebf..71c0b8f2 100644 --- a/src/config.rs +++ b/src/config.rs @@ -142,6 +142,22 @@ impl Config { let parsed_value = serde_json::from_str(&value) .unwrap_or_else(|_| serde_json::Value::String(value.to_string())); + if matches!(&*key, "book" | "build") { + if let serde_json::Value::Object(ref map) = parsed_value { + // To `set` each `key`, we wrap them as `prefix.key` + let prefix = &key; // "book" or "build" + let mut s = String::new(); + for (k, v) in map { + s.clear(); + s.push_str(prefix); + s.push('.'); + s.push_str(k); + self.set(&s, v).expect("unreachable"); + } + return; + } + } + self.set(key, parsed_value).expect("unreachable"); } }