From 793789bdf2da18c0198444209a05b4a11d160769 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Fri, 27 Oct 2023 20:27:50 -0400 Subject: [PATCH] Add entity. --- default_environment/templates/html/entity.dust | 2 +- src/context/entity.rs | 10 +++++++--- src/intermediate/entity.rs | 8 ++++++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/default_environment/templates/html/entity.dust b/default_environment/templates/html/entity.dust index cd06bfc..d3fae43 100644 --- a/default_environment/templates/html/entity.dust +++ b/default_environment/templates/html/entity.dust @@ -1 +1 @@ -entity +{.html|s} diff --git a/src/context/entity.rs b/src/context/entity.rs index f888dc5..8807a6d 100644 --- a/src/context/entity.rs +++ b/src/context/entity.rs @@ -9,15 +9,19 @@ use crate::intermediate::IEntity; #[derive(Debug, Serialize)] #[serde(tag = "type")] #[serde(rename = "entity")] -pub(crate) struct RenderEntity {} +pub(crate) struct RenderEntity { + html: String, +} impl RenderEntity { pub(crate) fn new( config: &Config, output_directory: &Path, output_file: &Path, - comment: &IEntity, + entity: &IEntity, ) -> Result { - Ok(RenderEntity {}) + Ok(RenderEntity { + html: entity.html.clone(), + }) } } diff --git a/src/intermediate/entity.rs b/src/intermediate/entity.rs index a3160cb..088a8e5 100644 --- a/src/intermediate/entity.rs +++ b/src/intermediate/entity.rs @@ -3,13 +3,17 @@ use crate::error::CustomError; use super::registry::Registry; #[derive(Debug)] -pub(crate) struct IEntity {} +pub(crate) struct IEntity { + pub(crate) html: String, +} impl IEntity { pub(crate) async fn new<'parse>( registry: &mut Registry<'parse>, original: &organic::types::Entity<'parse>, ) -> Result { - Ok(IEntity {}) + Ok(IEntity { + html: original.html.to_owned(), + }) } }