Use maud for test page
I want to replace askama with maud completely. It's so much nicer to be able to use Rust code and abstractions (e.g. functions) to compose HTML than using a bespoke templating system with weird inheritance and stuff. Even though said template system is checked at compile time. Actually, since it doesn't do hot reloading anyways, maud requiring a recompile for changes to become visible doesn't make the situation worse.
This commit is contained in:
parent
36ce75b43d
commit
cf590046e9
7 changed files with 112 additions and 0 deletions
27
src/server/web/pages/test.rs
Normal file
27
src/server/web/pages/test.rs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
use axum::{extract::State, response::IntoResponse};
|
||||
use maud::html;
|
||||
|
||||
use crate::{
|
||||
config::ServerConfig,
|
||||
server::web::{
|
||||
base::{Base, Tab},
|
||||
paths::PathTest,
|
||||
},
|
||||
somehow,
|
||||
};
|
||||
|
||||
pub async fn get_test(
|
||||
_path: PathTest,
|
||||
State(config): State<&'static ServerConfig>,
|
||||
) -> somehow::Result<impl IntoResponse> {
|
||||
let base = Base::new(config, Tab::Index);
|
||||
|
||||
Ok(base.html(
|
||||
"test",
|
||||
html! {},
|
||||
html! {
|
||||
h2 { "Test" }
|
||||
p { "Hello world!" }
|
||||
},
|
||||
))
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue