Move the render context to its own folder.

We are going to have a lot of render context types because there are so many org-mode elements/objects so I'm moving it to a separate folder for organization.
This commit is contained in:
Tom Alexander 2023-10-23 23:49:35 -04:00
parent 448e9bb8c6
commit 3cfcae25a9
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
6 changed files with 33 additions and 25 deletions

View File

@ -4,9 +4,9 @@ use std::path::PathBuf;
use crate::config::Config;
use crate::error::CustomError;
use crate::types::GlobalSettings;
use crate::types::RenderBlogPostPage;
use super::render_context::GlobalSettings;
use super::render_context::RenderBlogPostPage;
use super::BlogPost;
use super::BlogPostPage;

View File

@ -1,7 +1,6 @@
mod convert;
mod definition;
mod page;
mod render_context;
pub(crate) use convert::convert_blog_post_page_to_render_context;
pub(crate) use definition::BlogPost;
pub(crate) use page::BlogPostPage;

View File

@ -13,6 +13,7 @@ mod command;
mod config;
mod error;
mod render;
mod types;
fn main() -> Result<ExitCode, CustomError> {
let rt = tokio::runtime::Runtime::new()?;

View File

@ -1,27 +1,6 @@
use serde::Serialize;
/// The settings that a "global" to a single dustjs render.
#[derive(Debug, Serialize)]
pub(crate) struct GlobalSettings {
/// The title that goes in the html <title> tag in the <head>.
page_title: Option<String>,
css_files: Vec<String>,
js_files: Vec<String>,
}
impl GlobalSettings {
pub(crate) fn new(
page_title: Option<String>,
css_files: Vec<String>,
js_files: Vec<String>,
) -> GlobalSettings {
GlobalSettings {
page_title,
css_files,
js_files,
}
}
}
use super::GlobalSettings;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]

View File

@ -0,0 +1,24 @@
use serde::Serialize;
/// The settings that a "global" to a single dustjs render.
#[derive(Debug, Serialize)]
pub(crate) struct GlobalSettings {
/// The title that goes in the html <title> tag in the <head>.
page_title: Option<String>,
css_files: Vec<String>,
js_files: Vec<String>,
}
impl GlobalSettings {
pub(crate) fn new(
page_title: Option<String>,
css_files: Vec<String>,
js_files: Vec<String>,
) -> GlobalSettings {
GlobalSettings {
page_title,
css_files,
js_files,
}
}
}

5
src/types/mod.rs Normal file
View File

@ -0,0 +1,5 @@
mod blog_post_page;
mod global_settings;
pub(crate) use blog_post_page::RenderBlogPostPage;
pub(crate) use global_settings::GlobalSettings;