Compare commits

..

No commits in common. "5bbb12327bde2815fc03697231c504df7817cbff" and "4c3bea06d10d968d89acbd358fb3e99f8c980f90" have entirely different histories.

14 changed files with 177 additions and 227 deletions

View File

@ -1,3 +1 @@
<b>{#.children}
{>object/}
{/.children}</b>
bold

View File

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

View File

@ -1,3 +1 @@
<i>{#.children}
{>object/}
{/.children}</i>
italic

View File

@ -1 +1 @@
{.source}
plain_text

View File

@ -1,3 +1 @@
<blockquote>{#.children}
{>element/}
{/.children}</blockquote>
quote_block

View File

@ -1,3 +1 @@
<del>{#.children}
{>object/}
{/.children}</del>
strike_through

View File

@ -1,3 +1 @@
<u>{#.children}
{>object/}
{/.children}</u>
underline

View File

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

View File

@ -9,19 +9,15 @@ use crate::intermediate::IPlainText;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "plain_text")]
pub(crate) struct RenderPlainText {
source: String,
}
pub(crate) struct RenderPlainText {}
impl RenderPlainText {
pub(crate) fn new(
config: &Config,
output_directory: &Path,
output_file: &Path,
original: &IPlainText,
heading: &IPlainText,
) -> Result<RenderPlainText, CustomError> {
Ok(RenderPlainText {
source: original.source.clone(),
})
Ok(RenderPlainText {})
}
}

View File

@ -6,14 +6,10 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::IQuoteBlock;
use super::RenderElement;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "quote_block")]
pub(crate) struct RenderQuoteBlock {
children: Vec<RenderElement>,
}
pub(crate) struct RenderQuoteBlock {}
impl RenderQuoteBlock {
pub(crate) fn new(
@ -22,19 +18,6 @@ impl RenderQuoteBlock {
output_file: &Path,
original: &IQuoteBlock,
) -> Result<RenderQuoteBlock, CustomError> {
let children = {
let mut ret = Vec::new();
for obj in original.children.iter() {
ret.push(RenderElement::new(
config,
&output_directory,
&output_file,
obj,
)?);
}
ret
};
Ok(RenderQuoteBlock { children })
Ok(RenderQuoteBlock {})
}
}

View File

@ -25,7 +25,6 @@ use super::ISpecialBlock;
use super::ISrcBlock;
use super::ITable;
use super::IVerseBlock;
use futures::future::{BoxFuture, FutureExt};
#[derive(Debug)]
pub(crate) enum IElement {
@ -56,11 +55,10 @@ pub(crate) enum IElement {
}
impl IElement {
pub(crate) fn new<'parse, 'b>(
registry: &'b mut Registry<'parse>,
elem: &'b organic::types::Element<'parse>,
) -> BoxFuture<'b, Result<IElement, CustomError>> {
async move {
pub(crate) async fn new<'parse>(
registry: &mut Registry<'parse>,
elem: &organic::types::Element<'parse>,
) -> Result<IElement, CustomError> {
match elem {
organic::types::Element::Paragraph(inner) => {
Ok(IElement::Paragraph(IParagraph::new(registry, inner).await?))
@ -80,9 +78,9 @@ impl IElement {
organic::types::Element::DynamicBlock(inner) => Ok(IElement::DynamicBlock(
IDynamicBlock::new(registry, inner).await?,
)),
organic::types::Element::FootnoteDefinition(inner) => Ok(
IElement::FootnoteDefinition(IFootnoteDefinition::new(registry, inner).await?),
),
organic::types::Element::FootnoteDefinition(inner) => Ok(IElement::FootnoteDefinition(
IFootnoteDefinition::new(registry, inner).await?,
)),
organic::types::Element::Comment(inner) => {
Ok(IElement::Comment(IComment::new(registry, inner).await?))
}
@ -136,6 +134,4 @@ impl IElement {
)),
}
}
.boxed()
}
}

View File

@ -28,7 +28,6 @@ use super::timestamp::ITimestamp;
use super::underline::IUnderline;
use super::verbatim::IVerbatim;
use super::ITarget;
use futures::future::{BoxFuture, FutureExt};
#[derive(Debug)]
pub(crate) enum IObject {
@ -62,11 +61,10 @@ pub(crate) enum IObject {
}
impl IObject {
pub(crate) fn new<'parse, 'b>(
registry: &'b mut Registry<'parse>,
obj: &'b organic::types::Object<'parse>,
) -> BoxFuture<'b, Result<IObject, CustomError>> {
async move {
pub(crate) async fn new<'parse>(
registry: &mut Registry<'parse>,
obj: &organic::types::Object<'parse>,
) -> Result<IObject, CustomError> {
match obj {
organic::types::Object::Bold(inner) => {
Ok(IObject::Bold(IBold::new(registry, inner).await?))
@ -151,6 +149,4 @@ impl IObject {
}
}
}
.boxed()
}
}

View File

@ -5,7 +5,7 @@ use super::registry::Registry;
#[derive(Debug)]
pub(crate) struct IPlainText {
pub(crate) source: String,
source: String,
}
impl IPlainText {

View File

@ -1,26 +1,15 @@
use crate::error::CustomError;
use super::registry::Registry;
use super::IElement;
#[derive(Debug)]
pub(crate) struct IQuoteBlock {
pub(crate) children: Vec<IElement>,
}
pub(crate) struct IQuoteBlock {}
impl IQuoteBlock {
pub(crate) async fn new<'parse>(
registry: &mut Registry<'parse>,
original: &organic::types::QuoteBlock<'parse>,
) -> Result<IQuoteBlock, CustomError> {
let children = {
let mut ret = Vec::new();
for obj in original.children.iter() {
ret.push(IElement::new(registry, obj).await?);
}
ret
};
Ok(IQuoteBlock { children })
Ok(IQuoteBlock {})
}
}