Merge branch 'text_markup'

This commit is contained in:
Tom Alexander 2023-10-31 20:02:13 -04:00
commit 2142b01967
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
14 changed files with 247 additions and 33 deletions

View File

@ -1 +1 @@
<code>{.source}</code>
<code>{.contents}</code>

View File

@ -1 +1 @@
<code>{.source}</code>
<code>{.contents}</code>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,21 @@
use super::macros::inoop;
use super::macros::intermediate;
use super::IObject;
use crate::error::CustomError;
inoop!(IBold, Bold);
#[derive(Debug, Clone)]
pub(crate) struct IBold {
pub(crate) children: Vec<IObject>,
}
intermediate!(IBold, Bold, original, registry, {
let children = {
let mut ret = Vec::new();
for obj in original.children.iter() {
ret.push(IObject::new(registry.clone(), obj).await?);
}
ret
};
Ok(IBold { children })
});

View File

@ -1,5 +1,15 @@
use super::macros::inoop;
use super::macros::intermediate;
use crate::error::CustomError;
inoop!(ICode, Code);
#[derive(Debug, Clone)]
pub(crate) struct ICode {
pub(crate) contents: String,
}
intermediate!(ICode, Code, original, _registry, {
Ok(ICode {
// TODO: Should this coalesce whitespace like PlainText?
contents: original.contents.to_owned(),
})
});

View File

@ -1,5 +1,21 @@
use super::macros::inoop;
use super::macros::intermediate;
use super::IObject;
use crate::error::CustomError;
inoop!(IItalic, Italic);
#[derive(Debug, Clone)]
pub(crate) struct IItalic {
pub(crate) children: Vec<IObject>,
}
intermediate!(IItalic, Italic, original, registry, {
let children = {
let mut ret = Vec::new();
for obj in original.children.iter() {
ret.push(IObject::new(registry.clone(), obj).await?);
}
ret
};
Ok(IItalic { children })
});

View File

@ -1,5 +1,21 @@
use super::macros::inoop;
use super::macros::intermediate;
use super::IObject;
use crate::error::CustomError;
inoop!(IStrikeThrough, StrikeThrough);
#[derive(Debug, Clone)]
pub(crate) struct IStrikeThrough {
pub(crate) children: Vec<IObject>,
}
intermediate!(IStrikeThrough, StrikeThrough, original, registry, {
let children = {
let mut ret = Vec::new();
for obj in original.children.iter() {
ret.push(IObject::new(registry.clone(), obj).await?);
}
ret
};
Ok(IStrikeThrough { children })
});

View File

@ -1,6 +1,21 @@
use super::macros::intermediate;
use super::IObject;
use crate::error::CustomError;
use super::macros::inoop;
#[derive(Debug, Clone)]
pub(crate) struct IUnderline {
pub(crate) children: Vec<IObject>,
}
intermediate!(IUnderline, Underline, original, registry, {
let children = {
let mut ret = Vec::new();
for obj in original.children.iter() {
ret.push(IObject::new(registry.clone(), obj).await?);
}
ret
};
inoop!(IUnderline, Underline);
Ok(IUnderline { children })
});

View File

@ -1,6 +1,15 @@
use super::macros::intermediate;
use crate::error::CustomError;
use super::macros::inoop;
#[derive(Debug, Clone)]
pub(crate) struct IVerbatim {
pub(crate) contents: String,
}
inoop!(IVerbatim, Verbatim);
intermediate!(IVerbatim, Verbatim, original, _registry, {
Ok(IVerbatim {
// TODO: Should this coalesce whitespace like PlainText?
contents: original.contents.to_owned(),
})
});