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::IDocumentElement;
|
||||
|
||||
use super::macros::render;
|
||||
use super::RenderHeading;
|
||||
use super::RenderSection;
|
||||
|
||||
@@ -16,13 +17,14 @@ pub(crate) enum RenderDocumentElement {
|
||||
Section(RenderSection),
|
||||
}
|
||||
|
||||
impl RenderDocumentElement {
|
||||
pub(crate) fn new(
|
||||
config: &Config,
|
||||
output_directory: &Path,
|
||||
output_file: &Path,
|
||||
original: &IDocumentElement,
|
||||
) -> Result<RenderDocumentElement, CustomError> {
|
||||
render!(
|
||||
RenderDocumentElement,
|
||||
IDocumentElement,
|
||||
original,
|
||||
config,
|
||||
output_directory,
|
||||
output_file,
|
||||
{
|
||||
match original {
|
||||
IDocumentElement::Heading(inner) => Ok(RenderDocumentElement::Heading(
|
||||
RenderHeading::new(config, output_directory, output_file, inner)?,
|
||||
@@ -32,4 +34,4 @@ impl RenderDocumentElement {
|
||||
)),
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user