blob: 67dc0675acaf660b5427156bace4fedea946d417 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
/*
This file is part of jellything (https://codeberg.org/metamuffin/jellything)
which is licensed under the GNU Affero General Public License (version 3); see /COPYING.
Copyright (C) 2025 metamuffin <metamuffin.org>
*/
pub mod filter_sort;
pub mod format;
pub mod home;
pub mod locale;
pub mod node_card;
pub mod node_page;
pub mod props;
pub mod scaffold;
pub mod search;
pub mod settings;
pub mod stats;
/// render as supertrait would be possible but is not
/// dyn compatible and I really dont want to expose generics
/// that generate rendering code because of compile speed.
pub trait Page {
fn title(&self) -> String;
fn to_render(&self) -> DynRender;
fn class(&self) -> Option<&'static str> {
None
}
}
use markup::DynRender;
use scaffold::Scaffold;
pub fn render_page(page: &dyn Page) -> String {
Scaffold {
lang,
context,
class: page.class().unwrap_or("aaaa"),
title: page.title(),
main: page.to_render(),
}
.to_string()
}
|