Parse the org-mode files.

This commit is contained in:
Tom Alexander 2023-10-21 18:00:51 -04:00
parent acaa12cb6e
commit 816780589f
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
1 changed files with 16 additions and 1 deletions

View File

@ -8,7 +8,22 @@ use walkdir::WalkDir;
pub(crate) async fn build_site(args: BuildArgs) -> Result<(), Box<dyn std::error::Error>> {
let config = Config::load_from_file(args.config).await?;
let org_files = get_org_files(config.get_root_directory())?;
let org_files = {
let mut ret = Vec::new();
let org_files_iter = get_org_files(config.get_root_directory())?;
for entry in org_files_iter {
ret.push(entry.await??);
}
ret
};
let parsed_org_files = {
let mut ret = Vec::new();
for (path, contents) in org_files.iter() {
let parsed = organic::parser::parse_file(contents.as_str(), Some(path))?;
ret.push((path, contents, parsed));
}
ret
};
Ok(())
}