···1use chrono::{Datelike, Month};
2use indexmap::{IndexMap, IndexSet};
3-use minijinja::Environment;
4use serde::Serialize;
5use thiserror::Error;
67-use crate::{
8- page::{Item, PostLink},
9- templates::component::Component,
10-};
1112/// A data structure that maps each post to Y -> M -> D -> posts, preserving the order of
13/// the posts.
···4243 Ok(Archive(year_map))
44 }
45-}
46-47-impl<'e> Component for Archive<'e> {
48- const VIEW_NAME: &'static str = "archive";
49}
5051#[allow(dead_code)]
···1use chrono::{Datelike, Month};
2use indexmap::{IndexMap, IndexSet};
03use serde::Serialize;
4use thiserror::Error;
56+use crate::page::{Item, PostLink};
00078/// A data structure that maps each post to Y -> M -> D -> posts, preserving the order of
9/// the posts.
···3839 Ok(Archive(year_map))
40 }
000041}
4243#[allow(dead_code)]
+2-28
lx/src/data/config.rs
···44pub use serial::NavItem;
4546pub mod serial {
47- use std::{collections::HashMap, fmt::Display, sync::Arc};
4849 use camino::{Utf8Path, Utf8PathBuf};
50- use minijinja::{Environment, State, Value, value::Object};
51 use normalize_path::NormalizePath as _;
52 use serde::{Deserialize, Serialize};
53 use thiserror::Error;
5455- use crate::{data::email::Email, templates::component::Component};
5657 #[derive(Serialize, Deserialize, Debug)]
58 pub struct Config {
···117 pub enum NavItem {
118 Separator,
119 Page { title: String, path: String },
120- }
121-122- // NOTE(2025-10-09): this currently never gets hit when accessing via a template
123- // invocation that goes through `Config`, because `Config` and `NavItem` both
124- // implement `Serialize`, and so by the time the renderer is working with the
125- // `Config::nav` data, it is working with it as the *serialized* version of it,
126- // which means it never actually has a chance to see the `Component` version of it.
127- // In practice, this likely means that I need to get rid of the `Serialize` bound on
128- // `Component` and require custom rendering at each site (ugh) or find some other
129- // way to express these kinds of relations. _Le sigh_.
130- //
131- // TODO: also maybe move this elsewhere?
132- impl Component for NavItem {
133- const VIEW_NAME: &'static str = "nav-item";
134- }
135-136- impl Object for NavItem {
137- fn call(
138- self: &Arc<Self>,
139- state: &State<'_, '_>,
140- _args: &[Value],
141- ) -> Result<Value, minijinja::Error> {
142- println!("got here?");
143- self.view(state.env()).map(Value::from)
144- }
145 }
146147 #[derive(Error, Debug)]
···44pub use serial::NavItem;
4546pub mod serial {
47+ use std::{collections::HashMap, fmt::Display};
4849 use camino::{Utf8Path, Utf8PathBuf};
050 use normalize_path::NormalizePath as _;
51 use serde::{Deserialize, Serialize};
52 use thiserror::Error;
5354+ use crate::data::email::Email;
5556 #[derive(Serialize, Deserialize, Debug)]
57 pub struct Config {
···116 pub enum NavItem {
117 Separator,
118 Page { title: String, path: String },
0000000000000000000000000119 }
120121 #[derive(Error, Debug)]