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:
@@ -9,22 +9,15 @@ use crate::intermediate::IRealFootnoteDefinition;
|
||||
|
||||
use super::ast_node::IntoRenderAstNode;
|
||||
use super::ast_node::RenderAstNode;
|
||||
use super::macros::render;
|
||||
use super::macros::rnoop;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "type")]
|
||||
#[serde(rename = "footnote_definition")]
|
||||
pub(crate) struct RenderFootnoteDefinition {}
|
||||
|
||||
impl RenderFootnoteDefinition {
|
||||
pub(crate) fn new(
|
||||
_config: &Config,
|
||||
_output_directory: &Path,
|
||||
_output_file: &Path,
|
||||
_original: &IFootnoteDefinition,
|
||||
) -> Result<RenderFootnoteDefinition, CustomError> {
|
||||
Ok(RenderFootnoteDefinition {})
|
||||
}
|
||||
}
|
||||
rnoop!(RenderFootnoteDefinition, IFootnoteDefinition);
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "type")]
|
||||
@@ -36,13 +29,14 @@ pub(crate) struct RenderRealFootnoteDefinition {
|
||||
contents: Vec<RenderAstNode>,
|
||||
}
|
||||
|
||||
impl RenderRealFootnoteDefinition {
|
||||
pub(crate) fn new(
|
||||
config: &Config,
|
||||
output_directory: &Path,
|
||||
output_file: &Path,
|
||||
original: &IRealFootnoteDefinition,
|
||||
) -> Result<RenderRealFootnoteDefinition, CustomError> {
|
||||
render!(
|
||||
RenderRealFootnoteDefinition,
|
||||
IRealFootnoteDefinition,
|
||||
original,
|
||||
config,
|
||||
output_directory,
|
||||
output_file,
|
||||
{
|
||||
let contents = {
|
||||
let mut ret = Vec::new();
|
||||
for obj in original.contents.iter() {
|
||||
@@ -58,4 +52,4 @@ impl RenderRealFootnoteDefinition {
|
||||
contents,
|
||||
})
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user