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.
This commit is contained in:
Tom Alexander 2023-10-24 00:51:28 -04:00
parent 2b7a19a1d4
commit 31a3efe417
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
6 changed files with 10 additions and 7 deletions

View File

@ -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;

View File

@ -1,10 +1,14 @@
use crate::error::CustomError;
use super::Object;
#[derive(Debug)]
pub(crate) struct Heading {}
pub(crate) struct Heading {
title: Vec<Object>,
}
impl Heading {
pub(crate) fn new(heading: &organic::types::Heading<'_>) -> Result<Heading, CustomError> {
todo!()
Ok(Heading { title: Vec::new() })
}
}

View File

@ -5,6 +5,6 @@ pub(crate) struct Section {}
impl Section {
pub(crate) fn new(section: &organic::types::Section<'_>) -> Result<Section, CustomError> {
todo!()
Ok(Section {})
}
}

View File

@ -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.")?;

View File

@ -18,6 +18,6 @@ impl RenderSection {
output_file: F,
section: &Section,
) -> Result<RenderSection, CustomError> {
todo!()
Ok(RenderSection {})
}
}

View File

@ -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)