diff options
author | Lars Wirzenius <liw@liw.fi> | 2023-01-28 09:02:43 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2023-01-28 09:02:43 +0200 |
commit | 387f0b7675fba94115ead348c358c7d3e7638e4c (patch) | |
tree | 82483e5dad773cbf90884716e66a47629aa487fa /src/doc.rs | |
parent | fa5765189eef33bed301479410c4a53dc274acf0 (diff) | |
download | subplot-387f0b7675fba94115ead348c358c7d3e7638e4c.tar.gz |
refactor: move YamlMetadata to src/metadata.rs
YamlMetadata was in src/ast.rs, because originally it was only used to
parse metadata out of Markdown. Markdown parsing is now in its own
module, leaving ast.rs to only contain YamlMetadata. In this
situation, it seems tidy to have both kinds of metadata in the same
module, and to drop the now-empty ast.rs module.
Sponsored-by: author
Diffstat (limited to 'src/doc.rs')
-rw-r--r-- | src/doc.rs | 8 |
1 files changed, 3 insertions, 5 deletions
@@ -1,4 +1,3 @@ -use crate::ast; use crate::bindings::CaptureType; use crate::generate_test_program; use crate::get_basedir_from; @@ -6,12 +5,11 @@ use crate::md::Markdown; use crate::EmbeddedFile; use crate::EmbeddedFiles; use crate::MatchedScenario; -use crate::Metadata; use crate::PartialStep; use crate::Scenario; use crate::Style; use crate::SubplotError; -use crate::YamlMetadata; +use crate::{Metadata, YamlMetadata}; use crate::{Warning, Warnings}; use std::collections::HashSet; @@ -106,7 +104,7 @@ impl Document { basedir: P, subplot: PathBuf, markdowns: Vec<PathBuf>, - yamlmeta: &ast::YamlMetadata, + yamlmeta: &YamlMetadata, mut md: Markdown, style: Style, template: Option<&str>, @@ -422,7 +420,7 @@ impl Document { fn load_metadata_from_yaml_file(filename: &Path) -> Result<YamlMetadata, SubplotError> { let yaml = read(filename).map_err(|e| SubplotError::ReadFile(filename.into(), e))?; trace!("Parsing YAML metadata from {}", filename.display()); - let meta: ast::YamlMetadata = serde_yaml::from_slice(&yaml) + let meta: YamlMetadata = serde_yaml::from_slice(&yaml) .map_err(|e| SubplotError::MetadataFile(filename.into(), e))?; Ok(meta) } |