Add a dependency manager for render-time actions.
This will be used for supporting things like copying static files or rendering code blocks like gnuplot or graphviz.
This commit is contained in:
@@ -3,6 +3,8 @@ use std::path::Path;
|
||||
use crate::config::Config;
|
||||
use crate::error::CustomError;
|
||||
|
||||
use super::dependency_manager::RefDependencyManager;
|
||||
|
||||
/// The supporting information used for converting the intermediate representation into the dust context for rendering.
|
||||
#[derive(Debug, Clone)]
|
||||
pub(crate) struct RenderContext<'intermediate> {
|
||||
@@ -16,6 +18,13 @@ pub(crate) struct RenderContext<'intermediate> {
|
||||
/// IDs, for example, multiple blog posts with footnotes in a blog
|
||||
/// stream.
|
||||
pub(crate) id_addition: Option<&'intermediate str>,
|
||||
|
||||
/// Tracks dependencies from rendering Org document(s).
|
||||
///
|
||||
/// Examples of dependencies would be:
|
||||
/// - Static files that need to be copied to the output folder
|
||||
/// - Code blocks that need to be executed (for example, gnuplot graphs)
|
||||
pub(crate) dependency_manager: RefDependencyManager,
|
||||
}
|
||||
|
||||
impl<'intermediate> RenderContext<'intermediate> {
|
||||
@@ -24,12 +33,14 @@ impl<'intermediate> RenderContext<'intermediate> {
|
||||
output_directory: &'intermediate Path,
|
||||
output_file: &'intermediate Path,
|
||||
id_addition: Option<&'intermediate str>,
|
||||
dependency_manager: RefDependencyManager,
|
||||
) -> Result<RenderContext<'intermediate>, CustomError> {
|
||||
Ok(RenderContext {
|
||||
config,
|
||||
output_root_directory: output_directory,
|
||||
output_file,
|
||||
id_addition,
|
||||
dependency_manager,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user