Add render stage for text markup.
This commit is contained in:
parent
0fae417610
commit
159d8fb72a
@ -6,11 +6,37 @@ use crate::config::Config;
|
||||
use crate::error::CustomError;
|
||||
use crate::intermediate::IBold;
|
||||
|
||||
use super::macros::rnoop;
|
||||
use super::macros::render;
|
||||
use super::RenderObject;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "type")]
|
||||
#[serde(rename = "bold")]
|
||||
pub(crate) struct RenderBold {}
|
||||
pub(crate) struct RenderBold {
|
||||
children: Vec<RenderObject>,
|
||||
}
|
||||
|
||||
rnoop!(RenderBold, IBold);
|
||||
render!(
|
||||
RenderBold,
|
||||
IBold,
|
||||
original,
|
||||
config,
|
||||
output_directory,
|
||||
output_file,
|
||||
{
|
||||
let children = {
|
||||
let mut ret = Vec::new();
|
||||
for obj in original.children.iter() {
|
||||
ret.push(RenderObject::new(
|
||||
config,
|
||||
output_directory,
|
||||
output_file,
|
||||
obj,
|
||||
)?);
|
||||
}
|
||||
ret
|
||||
};
|
||||
|
||||
Ok(RenderBold { children })
|
||||
}
|
||||
);
|
||||
|
@ -6,11 +6,25 @@ use crate::config::Config;
|
||||
use crate::error::CustomError;
|
||||
use crate::intermediate::ICode;
|
||||
|
||||
use super::macros::rnoop;
|
||||
use super::macros::render;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "type")]
|
||||
#[serde(rename = "code")]
|
||||
pub(crate) struct RenderCode {}
|
||||
pub(crate) struct RenderCode {
|
||||
contents: String,
|
||||
}
|
||||
|
||||
rnoop!(RenderCode, ICode);
|
||||
render!(
|
||||
RenderCode,
|
||||
ICode,
|
||||
original,
|
||||
config,
|
||||
output_directory,
|
||||
output_file,
|
||||
{
|
||||
Ok(RenderCode {
|
||||
contents: original.contents.clone(),
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -6,11 +6,37 @@ use crate::config::Config;
|
||||
use crate::error::CustomError;
|
||||
use crate::intermediate::IItalic;
|
||||
|
||||
use super::macros::rnoop;
|
||||
use super::macros::render;
|
||||
use super::RenderObject;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "type")]
|
||||
#[serde(rename = "italic")]
|
||||
pub(crate) struct RenderItalic {}
|
||||
pub(crate) struct RenderItalic {
|
||||
children: Vec<RenderObject>,
|
||||
}
|
||||
|
||||
rnoop!(RenderItalic, IItalic);
|
||||
render!(
|
||||
RenderItalic,
|
||||
IItalic,
|
||||
original,
|
||||
config,
|
||||
output_directory,
|
||||
output_file,
|
||||
{
|
||||
let children = {
|
||||
let mut ret = Vec::new();
|
||||
for obj in original.children.iter() {
|
||||
ret.push(RenderObject::new(
|
||||
config,
|
||||
output_directory,
|
||||
output_file,
|
||||
obj,
|
||||
)?);
|
||||
}
|
||||
ret
|
||||
};
|
||||
|
||||
Ok(RenderItalic { children })
|
||||
}
|
||||
);
|
||||
|
@ -6,11 +6,37 @@ use crate::config::Config;
|
||||
use crate::error::CustomError;
|
||||
use crate::intermediate::IStrikeThrough;
|
||||
|
||||
use super::macros::rnoop;
|
||||
use super::macros::render;
|
||||
use super::RenderObject;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "type")]
|
||||
#[serde(rename = "strike_through")]
|
||||
pub(crate) struct RenderStrikeThrough {}
|
||||
pub(crate) struct RenderStrikeThrough {
|
||||
children: Vec<RenderObject>,
|
||||
}
|
||||
|
||||
rnoop!(RenderStrikeThrough, IStrikeThrough);
|
||||
render!(
|
||||
RenderStrikeThrough,
|
||||
IStrikeThrough,
|
||||
original,
|
||||
config,
|
||||
output_directory,
|
||||
output_file,
|
||||
{
|
||||
let children = {
|
||||
let mut ret = Vec::new();
|
||||
for obj in original.children.iter() {
|
||||
ret.push(RenderObject::new(
|
||||
config,
|
||||
output_directory,
|
||||
output_file,
|
||||
obj,
|
||||
)?);
|
||||
}
|
||||
ret
|
||||
};
|
||||
|
||||
Ok(RenderStrikeThrough { children })
|
||||
}
|
||||
);
|
||||
|
@ -6,11 +6,37 @@ use crate::config::Config;
|
||||
use crate::error::CustomError;
|
||||
use crate::intermediate::IUnderline;
|
||||
|
||||
use super::macros::rnoop;
|
||||
use super::macros::render;
|
||||
use super::RenderObject;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "type")]
|
||||
#[serde(rename = "underline")]
|
||||
pub(crate) struct RenderUnderline {}
|
||||
pub(crate) struct RenderUnderline {
|
||||
children: Vec<RenderObject>,
|
||||
}
|
||||
|
||||
rnoop!(RenderUnderline, IUnderline);
|
||||
render!(
|
||||
RenderUnderline,
|
||||
IUnderline,
|
||||
original,
|
||||
config,
|
||||
output_directory,
|
||||
output_file,
|
||||
{
|
||||
let children = {
|
||||
let mut ret = Vec::new();
|
||||
for obj in original.children.iter() {
|
||||
ret.push(RenderObject::new(
|
||||
config,
|
||||
output_directory,
|
||||
output_file,
|
||||
obj,
|
||||
)?);
|
||||
}
|
||||
ret
|
||||
};
|
||||
|
||||
Ok(RenderUnderline { children })
|
||||
}
|
||||
);
|
||||
|
@ -6,11 +6,25 @@ use crate::config::Config;
|
||||
use crate::error::CustomError;
|
||||
use crate::intermediate::IVerbatim;
|
||||
|
||||
use super::macros::rnoop;
|
||||
use super::macros::render;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "type")]
|
||||
#[serde(rename = "verbatim")]
|
||||
pub(crate) struct RenderVerbatim {}
|
||||
pub(crate) struct RenderVerbatim {
|
||||
contents: String,
|
||||
}
|
||||
|
||||
rnoop!(RenderVerbatim, IVerbatim);
|
||||
render!(
|
||||
RenderVerbatim,
|
||||
IVerbatim,
|
||||
original,
|
||||
config,
|
||||
output_directory,
|
||||
output_file,
|
||||
{
|
||||
Ok(RenderVerbatim {
|
||||
contents: original.contents.clone(),
|
||||
})
|
||||
}
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user