From: Huck Boles Date: Tue, 23 May 2023 23:24:37 +0000 (-0500) Subject: fixed: ignore header crashes rest of site X-Git-Url: https://git.huck.website/?a=commitdiff_plain;h=cf3ad9c08652b01b6eb1828028d0dec550be6bf6;p=metaforge.git fixed: ignore header crashes rest of site --- diff --git a/src/lib.rs b/src/lib.rs index 379d142..86a4eb2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -52,7 +52,12 @@ pub fn build_site(opts: &Options) -> Result<()> { ); let mut source = DirNode::build(opts.source.clone(), opts)?; - let global_init = MetaFile::new(opts); + + let global_init = if source.path.join("default.meta").exists() { + MetaFile::build(source.path.join("default.meta"), &opts)? + } else { + MetaFile::new(&opts) + }; source.map(&global_init)?; source.build_dir() diff --git a/src/metafile/dir.rs b/src/metafile/dir.rs index 447c46b..4b80825 100644 --- a/src/metafile/dir.rs +++ b/src/metafile/dir.rs @@ -6,11 +6,11 @@ use super::*; #[derive(Debug, Clone)] pub struct DirNode<'a> { - path: PathBuf, - opts: &'a Options, - global: MetaFile<'a>, - files: Vec>, - dirs: Vec>, + pub path: PathBuf, + pub opts: &'a Options, + pub global: MetaFile<'a>, + pub files: Vec>, + pub dirs: Vec>, } impl<'a> DirNode<'a> { @@ -39,8 +39,6 @@ impl<'a> DirNode<'a> { // parses all contained files and directories and pushes // parsed structures into the files and directories vectors pub fn map(&mut self, global: &'a MetaFile) -> Result<()> { - if self.opts.parallel {} - for f in fs::read_dir(&self.path)? { let file = f?.path(); @@ -57,6 +55,8 @@ impl<'a> DirNode<'a> { } } + eprintln!("{:#?}", self); + Ok(()) } diff --git a/src/metafile/file.rs b/src/metafile/file.rs index bfe86b4..37a8223 100644 --- a/src/metafile/file.rs +++ b/src/metafile/file.rs @@ -46,10 +46,6 @@ impl<'a> MetaFile<'a> { }; let mut metafile = parse_string(str, opts)?; - if metafile.header.ignore { - return Err(MetaError::Ignored.into()); - } - metafile.path = path; Ok(metafile) }