Add configuration options

This commit is contained in:
Juno Takano 2025-12-16 19:02:22 -03:00
commit 270fed54f0
16 changed files with 272 additions and 83 deletions

View file

@ -5,10 +5,16 @@ use axum::{
Form,
};
use crate::{formats::populate_graph, types::Node, handlers};
use crate::{
formats::populate_graph,
handlers,
syntax::content::parser,
types::{Config, Node},
syntax::content::elements::{span::Span, paragraph::Paragraph},
};
#[expect(clippy::unused_async)]
pub async fn nexus(template: &str) -> Response<Body> {
pub async fn page(template: &str) -> Response<Body> {
let mut context = tera::Context::new();
let graph = populate_graph();
let root_node = graph.get_root().unwrap_or_default();
@ -17,6 +23,14 @@ pub async fn nexus(template: &str) -> Response<Body> {
context.insert("nodes", &nodes);
context.insert("root_node", &root_node);
let text_parsed_config = Config {
footer_text: parser::read::<Span>(&graph.meta.config.footer_text),
about_text: parser::read::<Paragraph>(&graph.meta.config.about_text),
..graph.meta.config
};
context.insert("config", &text_parsed_config);
handlers::template::by_filename(template, &context, 500, None, false)
}