Add support for plain links.
All checks were successful
format Build format has succeeded
rust-test Build rust-test has succeeded
rust-clippy Build rust-clippy has succeeded
build-natter Build build-natter has succeeded

This commit is contained in:
Tom Alexander 2023-12-23 19:12:17 -05:00
parent eb67327574
commit cb5d131097
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
3 changed files with 28 additions and 6 deletions

View File

@ -1 +1 @@
!!!!!!!! plain_link
<a href="{.raw_link}">{.raw_link}</a>

View File

@ -1,16 +1,21 @@
use serde::Serialize;
use super::macros::render;
use super::render_context::RenderContext;
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 {
raw_link: String,
post_blank: organic::types::PostBlank,
}
rnoop!(RenderPlainLink, IPlainLink);
render!(RenderPlainLink, IPlainLink, original, _render_context, {
Ok(RenderPlainLink {
raw_link: original.raw_link.clone(),
post_blank: original.post_blank,
})
});

View File

@ -1,5 +1,22 @@
use super::macros::inoop;
use super::macros::intermediate;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(IPlainLink, PlainLink);
#[derive(Debug, Clone)]
pub(crate) struct IPlainLink {
pub(crate) raw_link: String,
pub(crate) post_blank: organic::types::PostBlank,
}
intermediate!(
IPlainLink,
&'orig organic::types::PlainLink<'parse>,
original,
_intermediate_context,
{
Ok(IPlainLink {
raw_link: original.raw_link.to_owned(),
post_blank: original.get_post_blank(),
})
}
);