diff --git a/src/config/full.rs b/src/config/full.rs index fbfa5f8..ce5ce3c 100644 --- a/src/config/full.rs +++ b/src/config/full.rs @@ -8,6 +8,7 @@ use crate::error::CustomError; use super::raw::RawConfig; /// This is the config struct used by most of the code, which is an interpreted version of the RawConfig struct which is the raw disk-representation of the config. +#[derive(Debug)] pub(crate) struct Config { raw: RawConfig, config_path: PathBuf, diff --git a/src/config/raw.rs b/src/config/raw.rs index 2e69d63..29cb4b9 100644 --- a/src/config/raw.rs +++ b/src/config/raw.rs @@ -2,7 +2,7 @@ use serde::Deserialize; use serde::Serialize; /// This is the struct for the writer.toml config file that ends up in each site's root directory. -#[derive(Deserialize, Serialize)] +#[derive(Debug, Deserialize, Serialize)] pub(crate) struct RawConfig { pub(super) site_title: Option, author: Option, @@ -25,7 +25,7 @@ impl Default for RawConfig { } } -#[derive(Deserialize, Serialize)] +#[derive(Debug, Deserialize, Serialize)] pub(crate) struct RawConfigStream { pub(super) entries_per_page: Option, } diff --git a/src/context/mod.rs b/src/context/mod.rs index 76a0921..abaec4d 100644 --- a/src/context/mod.rs +++ b/src/context/mod.rs @@ -48,6 +48,7 @@ mod quote_block; mod radio_link; mod radio_target; mod regular_link; +mod render_context; mod section; mod special_block; mod src_block; diff --git a/src/context/render_context.rs b/src/context/render_context.rs new file mode 100644 index 0000000..4c8fcb7 --- /dev/null +++ b/src/context/render_context.rs @@ -0,0 +1,27 @@ +use std::path::Path; + +use crate::config::Config; +use crate::error::CustomError; + +/// The supporting information used for converting the intermediate representation into the dust context for rendering. +#[derive(Debug, Clone)] +pub(crate) struct RenderContext<'intermediate> { + pub(crate) config: &'intermediate Config, + // TODO: Perhaps rename to output_root_directory. + pub(crate) output_directory: &'intermediate Path, + pub(crate) output_file: &'intermediate Path, +} + +impl<'intermediate> RenderContext<'intermediate> { + pub(crate) fn new( + config: &'intermediate Config, + output_directory: &'intermediate Path, + output_file: &'intermediate Path, + ) -> Result, CustomError> { + Ok(RenderContext { + config, + output_directory, + output_file, + }) + } +}