From 31a3efe4176081f23577484c52d95bffab9fcb3c Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Tue, 24 Oct 2023 00:51:28 -0400 Subject: [PATCH] Only print the contexts. This allows us to pipe the output to jq to see the context easier. We can see the rendered output in the files written to disk. --- src/blog_post/convert.rs | 2 +- src/blog_post/heading.rs | 8 ++++++-- src/blog_post/section.rs | 2 +- src/command/build/render.rs | 1 - src/context/section.rs | 2 +- src/render/duster_renderer.rs | 2 +- 6 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/blog_post/convert.rs b/src/blog_post/convert.rs index 0c2fb80..293b491 100644 --- a/src/blog_post/convert.rs +++ b/src/blog_post/convert.rs @@ -3,9 +3,9 @@ use std::path::Path; use std::path::PathBuf; use crate::config::Config; -use crate::error::CustomError; use crate::context::GlobalSettings; use crate::context::RenderBlogPostPage; +use crate::error::CustomError; use super::BlogPost; use super::BlogPostPage; diff --git a/src/blog_post/heading.rs b/src/blog_post/heading.rs index 95a0cee..d889bf2 100644 --- a/src/blog_post/heading.rs +++ b/src/blog_post/heading.rs @@ -1,10 +1,14 @@ use crate::error::CustomError; +use super::Object; + #[derive(Debug)] -pub(crate) struct Heading {} +pub(crate) struct Heading { + title: Vec, +} impl Heading { pub(crate) fn new(heading: &organic::types::Heading<'_>) -> Result { - todo!() + Ok(Heading { title: Vec::new() }) } } diff --git a/src/blog_post/section.rs b/src/blog_post/section.rs index 098dd6c..b7b888d 100644 --- a/src/blog_post/section.rs +++ b/src/blog_post/section.rs @@ -5,6 +5,6 @@ pub(crate) struct Section {} impl Section { pub(crate) fn new(section: &organic::types::Section<'_>) -> Result { - todo!() + Ok(Section {}) } } diff --git a/src/command/build/render.rs b/src/command/build/render.rs index 808d5b3..04a73f6 100644 --- a/src/command/build/render.rs +++ b/src/command/build/render.rs @@ -72,7 +72,6 @@ impl SiteRenderer { blog_post_page, )?; let rendered_output = renderer_integration.render(render_context)?; - println!("Rendered: {}", rendered_output); let parent_directory = output_path .parent() .ok_or("Output file should have a containing directory.")?; diff --git a/src/context/section.rs b/src/context/section.rs index 12d0a71..ff11345 100644 --- a/src/context/section.rs +++ b/src/context/section.rs @@ -18,6 +18,6 @@ impl RenderSection { output_file: F, section: &Section, ) -> Result { - todo!() + Ok(RenderSection {}) } } diff --git a/src/render/duster_renderer.rs b/src/render/duster_renderer.rs index 5602731..e5078a9 100644 --- a/src/render/duster_renderer.rs +++ b/src/render/duster_renderer.rs @@ -34,7 +34,7 @@ impl<'a> RendererIntegration<'a> for DusterRenderer<'a> { } // TODO: This is horribly inefficient. I am converting from a serialize type to json and back again so I can use the existing implementation of IntoContextElement. Honestly, I probably need to rework a lot of duster now that I've improved in rust over the years. let json_context = serde_json::to_string(&context)?; - println!("Context: {}", json_context); + println!("{}", json_context); let parsed_context: serde_json::Value = serde_json::from_str(json_context.as_str())?; let rendered_output = dust_renderer.render("main", Some(&parsed_context))?; Ok(rendered_output)