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::IRegularLink;
|
||||
|
||||
use super::macros::render;
|
||||
use super::RenderObject;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
@@ -16,16 +17,17 @@ pub(crate) struct RenderRegularLink {
|
||||
children: Vec<RenderObject>,
|
||||
}
|
||||
|
||||
impl RenderRegularLink {
|
||||
pub(crate) fn new(
|
||||
config: &Config,
|
||||
output_directory: &Path,
|
||||
output_file: &Path,
|
||||
regular_link: &IRegularLink,
|
||||
) -> Result<RenderRegularLink, CustomError> {
|
||||
render!(
|
||||
RenderRegularLink,
|
||||
IRegularLink,
|
||||
original,
|
||||
config,
|
||||
output_directory,
|
||||
output_file,
|
||||
{
|
||||
let children = {
|
||||
let mut ret = Vec::new();
|
||||
for obj in regular_link.children.iter() {
|
||||
for obj in original.children.iter() {
|
||||
ret.push(RenderObject::new(
|
||||
config,
|
||||
output_directory,
|
||||
@@ -37,8 +39,8 @@ impl RenderRegularLink {
|
||||
};
|
||||
|
||||
Ok(RenderRegularLink {
|
||||
raw_link: regular_link.raw_link.clone(),
|
||||
raw_link: original.raw_link.clone(),
|
||||
children,
|
||||
})
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user