Allow configuring dmdoc module directories

This commit is contained in:
Tad Hardesty 2020-12-09 20:32:46 -08:00
parent 18c02d980e
commit a5857a9cd8
2 changed files with 16 additions and 9 deletions

View file

@ -97,15 +97,21 @@ fn main2() -> Result<(), Box<dyn std::error::Error>> {
index_path = context.config().dmdoc.index_file.clone();
}
// Any top-level directory which is `#include`d in the `.dme` (most
// importantly "code", but also "_maps", "interface", and any downstream
// modular folders) will be searched for `.md` files to include in the docs.
let mut code_directories = std::collections::HashSet::new();
context.file_list().for_each(|path| {
if let Some(std::path::Component::Normal(first)) = path.components().next() {
code_directories.insert(first.to_owned());
}
});
let mut code_directories: std::collections::HashSet<std::ffi::OsString>;
if context.config().dmdoc.module_directories.is_empty() {
// Any top-level directory which is `#include`d in the `.dme` (most
// importantly "code", but also "_maps", "interface", and any downstream
// modular folders) will be searched for `.md` files to include in the docs.
code_directories = Default::default();
context.file_list().for_each(|path| {
if let Some(std::path::Component::Normal(first)) = path.components().next() {
code_directories.insert(first.to_owned());
}
});
} else {
// Use what the config specifies without any additional logic.
code_directories = context.config().dmdoc.module_directories.iter().map(std::ffi::OsString::from).collect();
}
// get a read on which types *have* docs
let mut types_with_docs = BTreeMap::new();

View file

@ -54,6 +54,7 @@ pub struct CodeStandards {
pub struct DMDoc {
pub use_typepath_names: bool,
pub index_file: Option<String>,
pub module_directories: Vec<String>,
}
// Debugger config options