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:
Tom Alexander 2023-10-31 19:48:05 -04:00
parent 5e476e189a
commit ae933b491e
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
56 changed files with 304 additions and 537 deletions

View File

@ -6,18 +6,11 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::IAngleLink;
use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "angle_link")]
pub(crate) struct RenderAngleLink {}
impl RenderAngleLink {
pub(crate) fn new(
_config: &Config,
_output_directory: &Path,
_output_file: &Path,
_comment: &IAngleLink,
) -> Result<RenderAngleLink, CustomError> {
Ok(RenderAngleLink {})
}
}
rnoop!(RenderAngleLink, IAngleLink);

View File

@ -6,18 +6,11 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::IBabelCall;
use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "babel_call")]
pub(crate) struct RenderBabelCall {}
impl RenderBabelCall {
pub(crate) fn new(
_config: &Config,
_output_directory: &Path,
_output_file: &Path,
_original: &IBabelCall,
) -> Result<RenderBabelCall, CustomError> {
Ok(RenderBabelCall {})
}
}
rnoop!(RenderBabelCall, IBabelCall);

View File

@ -21,6 +21,7 @@ pub(crate) struct RenderBlogPostPage {
}
impl RenderBlogPostPage {
// TODO: Maybe these settings should be moved into a common struct so this can have the same type signature as the others.
pub(crate) fn new(
global_settings: GlobalSettings,
title: Option<String>,

View File

@ -6,18 +6,11 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::IBold;
use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "bold")]
pub(crate) struct RenderBold {}
impl RenderBold {
pub(crate) fn new(
_config: &Config,
_output_directory: &Path,
_output_file: &Path,
_comment: &IBold,
) -> Result<RenderBold, CustomError> {
Ok(RenderBold {})
}
}
rnoop!(RenderBold, IBold);

View File

@ -6,18 +6,11 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::ICenterBlock;
use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "center_block")]
pub(crate) struct RenderCenterBlock {}
impl RenderCenterBlock {
pub(crate) fn new(
_config: &Config,
_output_directory: &Path,
_output_file: &Path,
_original: &ICenterBlock,
) -> Result<RenderCenterBlock, CustomError> {
Ok(RenderCenterBlock {})
}
}
rnoop!(RenderCenterBlock, ICenterBlock);

View File

@ -6,18 +6,11 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::ICitation;
use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "citation")]
pub(crate) struct RenderCitation {}
impl RenderCitation {
pub(crate) fn new(
_config: &Config,
_output_directory: &Path,
_output_file: &Path,
_comment: &ICitation,
) -> Result<RenderCitation, CustomError> {
Ok(RenderCitation {})
}
}
rnoop!(RenderCitation, ICitation);

View File

@ -6,18 +6,11 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::ICitationReference;
use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "citation_reference")]
pub(crate) struct RenderCitationReference {}
impl RenderCitationReference {
pub(crate) fn new(
_config: &Config,
_output_directory: &Path,
_output_file: &Path,
_comment: &ICitationReference,
) -> Result<RenderCitationReference, CustomError> {
Ok(RenderCitationReference {})
}
}
rnoop!(RenderCitationReference, ICitationReference);

View File

@ -6,18 +6,11 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::IClock;
use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "clock")]
pub(crate) struct RenderClock {}
impl RenderClock {
pub(crate) fn new(
_config: &Config,
_output_directory: &Path,
_output_file: &Path,
_original: &IClock,
) -> Result<RenderClock, CustomError> {
Ok(RenderClock {})
}
}
rnoop!(RenderClock, IClock);

View File

@ -6,18 +6,11 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::ICode;
use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "code")]
pub(crate) struct RenderCode {}
impl RenderCode {
pub(crate) fn new(
_config: &Config,
_output_directory: &Path,
_output_file: &Path,
_comment: &ICode,
) -> Result<RenderCode, CustomError> {
Ok(RenderCode {})
}
}
rnoop!(RenderCode, ICode);

View File

@ -6,18 +6,11 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::ICommentBlock;
use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "comment_block")]
pub(crate) struct RenderCommentBlock {}
impl RenderCommentBlock {
pub(crate) fn new(
_config: &Config,
_output_directory: &Path,
_output_file: &Path,
_original: &ICommentBlock,
) -> Result<RenderCommentBlock, CustomError> {
Ok(RenderCommentBlock {})
}
}
rnoop!(RenderCommentBlock, ICommentBlock);

View File

@ -6,18 +6,11 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::IDiarySexp;
use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "diary_sexp")]
pub(crate) struct RenderDiarySexp {}
impl RenderDiarySexp {
pub(crate) fn new(
_config: &Config,
_output_directory: &Path,
_output_file: &Path,
_original: &IDiarySexp,
) -> Result<RenderDiarySexp, CustomError> {
Ok(RenderDiarySexp {})
}
}
rnoop!(RenderDiarySexp, IDiarySexp);

View File

@ -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 {
)),
}
}
}
);

View File

@ -6,18 +6,11 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::IDrawer;
use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "drawer")]
pub(crate) struct RenderDrawer {}
impl RenderDrawer {
pub(crate) fn new(
_config: &Config,
_output_directory: &Path,
_output_file: &Path,
_original: &IDrawer,
) -> Result<RenderDrawer, CustomError> {
Ok(RenderDrawer {})
}
}
rnoop!(RenderDrawer, IDrawer);

View File

@ -6,18 +6,11 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::IDynamicBlock;
use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "dynamic_block")]
pub(crate) struct RenderDynamicBlock {}
impl RenderDynamicBlock {
pub(crate) fn new(
_config: &Config,
_output_directory: &Path,
_output_file: &Path,
_original: &IDynamicBlock,
) -> Result<RenderDynamicBlock, CustomError> {
Ok(RenderDynamicBlock {})
}
}
rnoop!(RenderDynamicBlock, IDynamicBlock);

View File

@ -21,6 +21,7 @@ use super::footnote_definition::RenderFootnoteDefinition;
use super::horizontal_rule::RenderHorizontalRule;
use super::keyword::RenderKeyword;
use super::latex_environment::RenderLatexEnvironment;
use super::macros::render;
use super::paragraph::RenderParagraph;
use super::plain_list::RenderPlainList;
use super::planning::RenderPlanning;
@ -60,14 +61,15 @@ pub(crate) enum RenderElement {
LatexEnvironment(RenderLatexEnvironment),
}
impl RenderElement {
pub(crate) fn new(
config: &Config,
output_directory: &Path,
output_file: &Path,
element: &IElement,
) -> Result<RenderElement, CustomError> {
match element {
render!(
RenderElement,
IElement,
original,
config,
output_directory,
output_file,
{
match original {
IElement::Paragraph(inner) => Ok(RenderElement::Paragraph(RenderParagraph::new(
config,
output_directory,
@ -187,4 +189,4 @@ impl RenderElement {
)),
}
}
}
);

View File

@ -6,6 +6,8 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::IEntity;
use super::macros::render;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "entity")]
@ -13,15 +15,16 @@ pub(crate) struct RenderEntity {
html: String,
}
impl RenderEntity {
pub(crate) fn new(
_config: &Config,
_output_directory: &Path,
_output_file: &Path,
entity: &IEntity,
) -> Result<RenderEntity, CustomError> {
render!(
RenderEntity,
IEntity,
original,
config,
output_directory,
output_file,
{
Ok(RenderEntity {
html: entity.html.clone(),
html: original.html.clone(),
})
}
}
);

View File

@ -6,18 +6,11 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::IExampleBlock;
use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "example_block")]
pub(crate) struct RenderExampleBlock {}
impl RenderExampleBlock {
pub(crate) fn new(
_config: &Config,
_output_directory: &Path,
_output_file: &Path,
_original: &IExampleBlock,
) -> Result<RenderExampleBlock, CustomError> {
Ok(RenderExampleBlock {})
}
}
rnoop!(RenderExampleBlock, IExampleBlock);

View File

@ -6,18 +6,11 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::IExportBlock;
use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "export_block")]
pub(crate) struct RenderExportBlock {}
impl RenderExportBlock {
pub(crate) fn new(
_config: &Config,
_output_directory: &Path,
_output_file: &Path,
_original: &IExportBlock,
) -> Result<RenderExportBlock, CustomError> {
Ok(RenderExportBlock {})
}
}
rnoop!(RenderExportBlock, IExportBlock);

View File

@ -6,18 +6,11 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::IExportSnippet;
use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "export_snippet")]
pub(crate) struct RenderExportSnippet {}
impl RenderExportSnippet {
pub(crate) fn new(
_config: &Config,
_output_directory: &Path,
_output_file: &Path,
_comment: &IExportSnippet,
) -> Result<RenderExportSnippet, CustomError> {
Ok(RenderExportSnippet {})
}
}
rnoop!(RenderExportSnippet, IExportSnippet);

View File

@ -6,18 +6,11 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::IFixedWidthArea;
use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "fixed_width_area")]
pub(crate) struct RenderFixedWidthArea {}
impl RenderFixedWidthArea {
pub(crate) fn new(
_config: &Config,
_output_directory: &Path,
_output_file: &Path,
_original: &IFixedWidthArea,
) -> Result<RenderFixedWidthArea, CustomError> {
Ok(RenderFixedWidthArea {})
}
}
rnoop!(RenderFixedWidthArea, IFixedWidthArea);

View File

@ -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,
})
}
}
);

View File

@ -6,6 +6,8 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::IFootnoteReference;
use super::macros::render;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "footnote_reference")]
@ -15,17 +17,18 @@ pub(crate) struct RenderFootnoteReference {
label: String,
}
impl RenderFootnoteReference {
pub(crate) fn new(
_config: &Config,
_output_directory: &Path,
_output_file: &Path,
original: &IFootnoteReference,
) -> Result<RenderFootnoteReference, CustomError> {
render!(
RenderFootnoteReference,
IFootnoteReference,
original,
config,
output_directory,
output_file,
{
Ok(RenderFootnoteReference {
reference_id: original.get_reference_id(),
definition_link: format!("#{}", original.get_definition_id()),
label: original.get_display_label(),
})
}
}
);

View File

@ -6,6 +6,7 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::IHeading;
use super::macros::render;
use super::RenderDocumentElement;
use super::RenderObject;
@ -18,16 +19,17 @@ pub(crate) struct RenderHeading {
children: Vec<RenderDocumentElement>,
}
impl RenderHeading {
pub(crate) fn new(
config: &Config,
output_directory: &Path,
output_file: &Path,
heading: &IHeading,
) -> Result<RenderHeading, CustomError> {
render!(
RenderHeading,
IHeading,
original,
config,
output_directory,
output_file,
{
let title = {
let mut ret = Vec::new();
for obj in heading.title.iter() {
for obj in original.title.iter() {
ret.push(RenderObject::new(
config,
output_directory,
@ -40,7 +42,7 @@ impl RenderHeading {
let children = {
let mut ret = Vec::new();
for obj in heading.children.iter() {
for obj in original.children.iter() {
ret.push(RenderDocumentElement::new(
config,
output_directory,
@ -52,9 +54,9 @@ impl RenderHeading {
};
Ok(RenderHeading {
level: heading.level + 1, // Adding 1 because the page title is going to be h1.
level: original.level + 1, // Adding 1 because the page title is going to be h1.
title,
children,
})
}
}
);

View File

@ -6,18 +6,11 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::IHorizontalRule;
use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "horizontal_rule")]
pub(crate) struct RenderHorizontalRule {}
impl RenderHorizontalRule {
pub(crate) fn new(
_config: &Config,
_output_directory: &Path,
_output_file: &Path,
_original: &IHorizontalRule,
) -> Result<RenderHorizontalRule, CustomError> {
Ok(RenderHorizontalRule {})
}
}
rnoop!(RenderHorizontalRule, IHorizontalRule);

View File

@ -6,18 +6,11 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::IInlineBabelCall;
use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "inline_babel_call")]
pub(crate) struct RenderInlineBabelCall {}
impl RenderInlineBabelCall {
pub(crate) fn new(
_config: &Config,
_output_directory: &Path,
_output_file: &Path,
_comment: &IInlineBabelCall,
) -> Result<RenderInlineBabelCall, CustomError> {
Ok(RenderInlineBabelCall {})
}
}
rnoop!(RenderInlineBabelCall, IInlineBabelCall);

View File

@ -6,6 +6,8 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::IInlineSourceBlock;
use super::macros::render;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "inline_source_block")]
@ -13,15 +15,16 @@ pub(crate) struct RenderInlineSourceBlock {
value: String,
}
impl RenderInlineSourceBlock {
pub(crate) fn new(
_config: &Config,
_output_directory: &Path,
_output_file: &Path,
original: &IInlineSourceBlock,
) -> Result<RenderInlineSourceBlock, CustomError> {
render!(
RenderInlineSourceBlock,
IInlineSourceBlock,
original,
config,
output_directory,
output_file,
{
Ok(RenderInlineSourceBlock {
value: original.value.clone(),
})
}
}
);

View File

@ -6,18 +6,11 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::IItalic;
use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "italic")]
pub(crate) struct RenderItalic {}
impl RenderItalic {
pub(crate) fn new(
_config: &Config,
_output_directory: &Path,
_output_file: &Path,
_comment: &IItalic,
) -> Result<RenderItalic, CustomError> {
Ok(RenderItalic {})
}
}
rnoop!(RenderItalic, IItalic);

View File

@ -6,18 +6,11 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::IKeyword;
use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "keyword")]
pub(crate) struct RenderKeyword {}
impl RenderKeyword {
pub(crate) fn new(
_config: &Config,
_output_directory: &Path,
_output_file: &Path,
_keyword: &IKeyword,
) -> Result<RenderKeyword, CustomError> {
Ok(RenderKeyword {})
}
}
rnoop!(RenderKeyword, IKeyword);

View File

@ -6,18 +6,11 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::ILatexEnvironment;
use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "latex_environment")]
pub(crate) struct RenderLatexEnvironment {}
impl RenderLatexEnvironment {
pub(crate) fn new(
_config: &Config,
_output_directory: &Path,
_output_file: &Path,
_original: &ILatexEnvironment,
) -> Result<RenderLatexEnvironment, CustomError> {
Ok(RenderLatexEnvironment {})
}
}
rnoop!(RenderLatexEnvironment, ILatexEnvironment);

View File

@ -6,18 +6,11 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::ILineBreak;
use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "line_break")]
pub(crate) struct RenderLineBreak {}
impl RenderLineBreak {
pub(crate) fn new(
_config: &Config,
_output_directory: &Path,
_output_file: &Path,
_comment: &ILineBreak,
) -> Result<RenderLineBreak, CustomError> {
Ok(RenderLineBreak {})
}
}
rnoop!(RenderLineBreak, ILineBreak);

View File

@ -19,6 +19,7 @@ use super::inline_source_block::RenderInlineSourceBlock;
use super::italic::RenderItalic;
use super::latex_fragment::RenderLatexFragment;
use super::line_break::RenderLineBreak;
use super::macros::render;
use super::org_macro::RenderOrgMacro;
use super::plain_link::RenderPlainLink;
use super::plain_text::RenderPlainText;
@ -66,14 +67,15 @@ pub(crate) enum RenderObject {
Timestamp(RenderTimestamp),
}
impl RenderObject {
pub(crate) fn new(
config: &Config,
output_directory: &Path,
output_file: &Path,
object: &IObject,
) -> Result<RenderObject, CustomError> {
match object {
render!(
RenderObject,
IObject,
original,
config,
output_directory,
output_file,
{
match original {
IObject::Bold(inner) => Ok(RenderObject::Bold(RenderBold::new(
config,
output_directory,
@ -214,4 +216,4 @@ impl RenderObject {
)?)),
}
}
}
);

View File

@ -6,18 +6,11 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::IOrgMacro;
use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "org_macro")]
pub(crate) struct RenderOrgMacro {}
impl RenderOrgMacro {
pub(crate) fn new(
_config: &Config,
_output_directory: &Path,
_output_file: &Path,
_comment: &IOrgMacro,
) -> Result<RenderOrgMacro, CustomError> {
Ok(RenderOrgMacro {})
}
}
rnoop!(RenderOrgMacro, IOrgMacro);

View File

@ -6,6 +6,7 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::IParagraph;
use super::macros::render;
use super::RenderObject;
#[derive(Debug, Serialize)]
@ -15,16 +16,17 @@ pub(crate) struct RenderParagraph {
children: Vec<RenderObject>,
}
impl RenderParagraph {
pub(crate) fn new(
config: &Config,
output_directory: &Path,
output_file: &Path,
paragraph: &IParagraph,
) -> Result<RenderParagraph, CustomError> {
render!(
RenderParagraph,
IParagraph,
original,
config,
output_directory,
output_file,
{
let children = {
let mut ret = Vec::new();
for obj in paragraph.children.iter() {
for obj in original.children.iter() {
ret.push(RenderObject::new(
config,
output_directory,
@ -37,4 +39,4 @@ impl RenderParagraph {
Ok(RenderParagraph { children })
}
}
);

View File

@ -6,18 +6,11 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::IPlainLink;
use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "plain_link")]
pub(crate) struct RenderPlainLink {}
impl RenderPlainLink {
pub(crate) fn new(
_config: &Config,
_output_directory: &Path,
_output_file: &Path,
_comment: &IPlainLink,
) -> Result<RenderPlainLink, CustomError> {
Ok(RenderPlainLink {})
}
}
rnoop!(RenderPlainLink, IPlainLink);

View File

@ -6,6 +6,7 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::IPlainList;
use super::macros::render;
use super::plain_list_item::RenderPlainListItem;
#[derive(Debug, Serialize)]
@ -16,13 +17,14 @@ pub(crate) struct RenderPlainList {
children: Vec<RenderPlainListItem>,
}
impl RenderPlainList {
pub(crate) fn new(
config: &Config,
output_directory: &Path,
output_file: &Path,
original: &IPlainList,
) -> Result<RenderPlainList, CustomError> {
render!(
RenderPlainList,
IPlainList,
original,
config,
output_directory,
output_file,
{
let list_type = match original.list_type {
organic::types::PlainListType::Unordered => "unordered".to_owned(),
organic::types::PlainListType::Ordered => "ordered".to_owned(),
@ -46,4 +48,4 @@ impl RenderPlainList {
children,
})
}
}
);

View File

@ -6,6 +6,7 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::IPlainListItem;
use super::macros::render;
use super::RenderElement;
use super::RenderObject;
@ -17,13 +18,14 @@ pub(crate) struct RenderPlainListItem {
children: Vec<RenderElement>,
}
impl RenderPlainListItem {
pub(crate) fn new(
config: &Config,
output_directory: &Path,
output_file: &Path,
original: &IPlainListItem,
) -> Result<RenderPlainListItem, CustomError> {
render!(
RenderPlainListItem,
IPlainListItem,
original,
config,
output_directory,
output_file,
{
let tag = {
let mut ret = Vec::new();
for obj in original.tag.iter() {
@ -51,4 +53,4 @@ impl RenderPlainListItem {
};
Ok(RenderPlainListItem { tag, children })
}
}
);

View File

@ -6,6 +6,8 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::IPlainText;
use super::macros::render;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "plain_text")]
@ -13,15 +15,16 @@ pub(crate) struct RenderPlainText {
source: String,
}
impl RenderPlainText {
pub(crate) fn new(
_config: &Config,
_output_directory: &Path,
_output_file: &Path,
original: &IPlainText,
) -> Result<RenderPlainText, CustomError> {
render!(
RenderPlainText,
IPlainText,
original,
config,
output_directory,
output_file,
{
Ok(RenderPlainText {
source: original.source.clone(),
})
}
}
);

View File

@ -6,18 +6,11 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::IPlanning;
use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "planning")]
pub(crate) struct RenderPlanning {}
impl RenderPlanning {
pub(crate) fn new(
_config: &Config,
_output_directory: &Path,
_output_file: &Path,
_original: &IPlanning,
) -> Result<RenderPlanning, CustomError> {
Ok(RenderPlanning {})
}
}
rnoop!(RenderPlanning, IPlanning);

View File

@ -6,18 +6,11 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::IPropertyDrawer;
use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "property_drawer")]
pub(crate) struct RenderPropertyDrawer {}
impl RenderPropertyDrawer {
pub(crate) fn new(
_config: &Config,
_output_directory: &Path,
_output_file: &Path,
_original: &IPropertyDrawer,
) -> Result<RenderPropertyDrawer, CustomError> {
Ok(RenderPropertyDrawer {})
}
}
rnoop!(RenderPropertyDrawer, IPropertyDrawer);

View File

@ -6,6 +6,7 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::IQuoteBlock;
use super::macros::render;
use super::RenderElement;
#[derive(Debug, Serialize)]
@ -15,13 +16,14 @@ pub(crate) struct RenderQuoteBlock {
children: Vec<RenderElement>,
}
impl RenderQuoteBlock {
pub(crate) fn new(
config: &Config,
output_directory: &Path,
output_file: &Path,
original: &IQuoteBlock,
) -> Result<RenderQuoteBlock, CustomError> {
render!(
RenderQuoteBlock,
IQuoteBlock,
original,
config,
output_directory,
output_file,
{
let children = {
let mut ret = Vec::new();
for obj in original.children.iter() {
@ -37,4 +39,4 @@ impl RenderQuoteBlock {
Ok(RenderQuoteBlock { children })
}
}
);

View File

@ -6,18 +6,11 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::IRadioLink;
use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "radio_link")]
pub(crate) struct RenderRadioLink {}
impl RenderRadioLink {
pub(crate) fn new(
_config: &Config,
_output_directory: &Path,
_output_file: &Path,
_comment: &IRadioLink,
) -> Result<RenderRadioLink, CustomError> {
Ok(RenderRadioLink {})
}
}
rnoop!(RenderRadioLink, IRadioLink);

View File

@ -6,18 +6,11 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::IRadioTarget;
use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "radio_target")]
pub(crate) struct RenderRadioTarget {}
impl RenderRadioTarget {
pub(crate) fn new(
_config: &Config,
_output_directory: &Path,
_output_file: &Path,
_comment: &IRadioTarget,
) -> Result<RenderRadioTarget, CustomError> {
Ok(RenderRadioTarget {})
}
}
rnoop!(RenderRadioTarget, IRadioTarget);

View File

@ -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,
})
}
}
);

View File

@ -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 })
}
}
);

View File

@ -6,18 +6,11 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::ISpecialBlock;
use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "special_block")]
pub(crate) struct RenderSpecialBlock {}
impl RenderSpecialBlock {
pub(crate) fn new(
_config: &Config,
_output_directory: &Path,
_output_file: &Path,
_original: &ISpecialBlock,
) -> Result<RenderSpecialBlock, CustomError> {
Ok(RenderSpecialBlock {})
}
}
rnoop!(RenderSpecialBlock, ISpecialBlock);

View File

@ -6,6 +6,8 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::ISrcBlock;
use super::macros::render;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "src_block")]
@ -13,15 +15,16 @@ pub(crate) struct RenderSrcBlock {
lines: Vec<String>,
}
impl RenderSrcBlock {
pub(crate) fn new(
_config: &Config,
_output_directory: &Path,
_output_file: &Path,
original: &ISrcBlock,
) -> Result<RenderSrcBlock, CustomError> {
render!(
RenderSrcBlock,
ISrcBlock,
original,
config,
output_directory,
output_file,
{
Ok(RenderSrcBlock {
lines: original.lines.clone(),
})
}
}
);

View File

@ -6,18 +6,11 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::IStatisticsCookie;
use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "statistics_cookie")]
pub(crate) struct RenderStatisticsCookie {}
impl RenderStatisticsCookie {
pub(crate) fn new(
_config: &Config,
_output_directory: &Path,
_output_file: &Path,
_comment: &IStatisticsCookie,
) -> Result<RenderStatisticsCookie, CustomError> {
Ok(RenderStatisticsCookie {})
}
}
rnoop!(RenderStatisticsCookie, IStatisticsCookie);

View File

@ -6,18 +6,11 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::IStrikeThrough;
use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "strike_through")]
pub(crate) struct RenderStrikeThrough {}
impl RenderStrikeThrough {
pub(crate) fn new(
_config: &Config,
_output_directory: &Path,
_output_file: &Path,
_comment: &IStrikeThrough,
) -> Result<RenderStrikeThrough, CustomError> {
Ok(RenderStrikeThrough {})
}
}
rnoop!(RenderStrikeThrough, IStrikeThrough);

View File

@ -6,18 +6,11 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::ISubscript;
use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "subscript")]
pub(crate) struct RenderSubscript {}
impl RenderSubscript {
pub(crate) fn new(
_config: &Config,
_output_directory: &Path,
_output_file: &Path,
_comment: &ISubscript,
) -> Result<RenderSubscript, CustomError> {
Ok(RenderSubscript {})
}
}
rnoop!(RenderSubscript, ISubscript);

View File

@ -6,18 +6,11 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::ISuperscript;
use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "superscript")]
pub(crate) struct RenderSuperscript {}
impl RenderSuperscript {
pub(crate) fn new(
_config: &Config,
_output_directory: &Path,
_output_file: &Path,
_comment: &ISuperscript,
) -> Result<RenderSuperscript, CustomError> {
Ok(RenderSuperscript {})
}
}
rnoop!(RenderSuperscript, ISuperscript);

View File

@ -6,18 +6,11 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::ITable;
use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "table")]
pub(crate) struct RenderTable {}
impl RenderTable {
pub(crate) fn new(
_config: &Config,
_output_directory: &Path,
_output_file: &Path,
_original: &ITable,
) -> Result<RenderTable, CustomError> {
Ok(RenderTable {})
}
}
rnoop!(RenderTable, ITable);

View File

@ -6,6 +6,8 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::ITarget;
use super::macros::render;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "target")]
@ -13,15 +15,16 @@ pub(crate) struct RenderTarget {
id: String,
}
impl RenderTarget {
pub(crate) fn new(
_config: &Config,
_output_directory: &Path,
_output_file: &Path,
target: &ITarget,
) -> Result<RenderTarget, CustomError> {
render!(
RenderTarget,
ITarget,
original,
config,
output_directory,
output_file,
{
Ok(RenderTarget {
id: target.id.clone(),
id: original.id.clone(),
})
}
}
);

View File

@ -6,18 +6,11 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::ITimestamp;
use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "timestamp")]
pub(crate) struct RenderTimestamp {}
impl RenderTimestamp {
pub(crate) fn new(
_config: &Config,
_output_directory: &Path,
_output_file: &Path,
_comment: &ITimestamp,
) -> Result<RenderTimestamp, CustomError> {
Ok(RenderTimestamp {})
}
}
rnoop!(RenderTimestamp, ITimestamp);

View File

@ -6,18 +6,11 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::IUnderline;
use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "underline")]
pub(crate) struct RenderUnderline {}
impl RenderUnderline {
pub(crate) fn new(
_config: &Config,
_output_directory: &Path,
_output_file: &Path,
_comment: &IUnderline,
) -> Result<RenderUnderline, CustomError> {
Ok(RenderUnderline {})
}
}
rnoop!(RenderUnderline, IUnderline);

View File

@ -6,18 +6,11 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::IVerbatim;
use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "verbatim")]
pub(crate) struct RenderVerbatim {}
impl RenderVerbatim {
pub(crate) fn new(
_config: &Config,
_output_directory: &Path,
_output_file: &Path,
_comment: &IVerbatim,
) -> Result<RenderVerbatim, CustomError> {
Ok(RenderVerbatim {})
}
}
rnoop!(RenderVerbatim, IVerbatim);

View File

@ -6,18 +6,11 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::IVerseBlock;
use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "verse_block")]
pub(crate) struct RenderVerseBlock {}
impl RenderVerseBlock {
pub(crate) fn new(
_config: &Config,
_output_directory: &Path,
_output_file: &Path,
_original: &IVerseBlock,
) -> Result<RenderVerseBlock, CustomError> {
Ok(RenderVerseBlock {})
}
}
rnoop!(RenderVerseBlock, IVerseBlock);