use serde::Serialize; use super::render_context::RenderContext; use crate::error::CustomError; use crate::intermediate::IRegularLink; use super::macros::render; use super::RenderObject; #[derive(Debug, Serialize)] #[serde(tag = "type")] #[serde(rename = "regular_link")] pub(crate) struct RenderRegularLink { target: String, raw_link: String, children: Vec, post_blank: organic::types::PostBlank, } render!(RenderRegularLink, IRegularLink, original, render_context, { let children = { let mut ret = Vec::new(); for obj in original.children.iter() { ret.push(RenderObject::new(render_context.clone(), obj)?); } ret }; let target = original .target .generate_final_target()? .unwrap_or_else(|| "".to_owned()); Ok(RenderRegularLink { target: target, raw_link: original.raw_link.clone(), children, post_blank: original.post_blank, }) });