Use macros for the intermediate to render step.
This is largely to make changing the type signature of these functions easier by significantly reducing the amount of places that duplicates the signature.
This commit is contained in:
@@ -6,6 +6,7 @@ use crate::config::Config;
|
||||
use crate::error::CustomError;
|
||||
use crate::intermediate::ISection;
|
||||
|
||||
use super::macros::render;
|
||||
use super::RenderElement;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
@@ -15,16 +16,17 @@ pub(crate) struct RenderSection {
|
||||
children: Vec<RenderElement>,
|
||||
}
|
||||
|
||||
impl RenderSection {
|
||||
pub(crate) fn new(
|
||||
config: &Config,
|
||||
output_directory: &Path,
|
||||
output_file: &Path,
|
||||
section: &ISection,
|
||||
) -> Result<RenderSection, CustomError> {
|
||||
render!(
|
||||
RenderSection,
|
||||
ISection,
|
||||
original,
|
||||
config,
|
||||
output_directory,
|
||||
output_file,
|
||||
{
|
||||
let children = {
|
||||
let mut ret = Vec::new();
|
||||
for obj in section.children.iter() {
|
||||
for obj in original.children.iter() {
|
||||
ret.push(RenderElement::new(
|
||||
config,
|
||||
output_directory,
|
||||
@@ -37,4 +39,4 @@ impl RenderSection {
|
||||
|
||||
Ok(RenderSection { children })
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user