move doctype into head

This commit is contained in:
JOLIMAITRE Matthieu 2024-08-04 17:35:16 +02:00
parent 86ffc13319
commit 5a021f9781
2 changed files with 3 additions and 8 deletions

View file

@ -1,9 +1,10 @@
use axum::response::IntoResponse; use axum::response::IntoResponse;
use maud::{html, Markup}; use maud::{html, Markup, DOCTYPE};
use stylist::{css, GlobalStyle}; use stylist::{css, GlobalStyle};
pub fn head(title: &str) -> Markup { pub fn head(title: &str) -> Markup {
html!( html!(
(DOCTYPE)
head { head {
title { "Recueil " (title) } title { "Recueil " (title) }
link rel = "stylesheet" href = "/style.css"; link rel = "stylesheet" href = "/style.css";

View file

@ -13,7 +13,7 @@ use axum::{
}; };
use chrono::prelude::*; use chrono::prelude::*;
use common::{footer, head, header, style}; use common::{footer, head, header, style};
use maud::{html, Escaper, Markup, PreEscaped, DOCTYPE}; use maud::{html, Escaper, Markup, PreEscaped};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use store::Store; use store::Store;
use tokio::net::TcpListener; use tokio::net::TcpListener;
@ -51,7 +51,6 @@ async fn main() -> Result<()> {
async fn home() -> Markup { async fn home() -> Markup {
html!( html!(
(DOCTYPE)
(head("")) (head(""))
body { body {
content { content {
@ -73,7 +72,6 @@ async fn home() -> Markup {
async fn topics(State(state): State<MainState>) -> impl IntoResponse { async fn topics(State(state): State<MainState>) -> impl IntoResponse {
let topics = state.store.read().unwrap().list().unwrap(); let topics = state.store.read().unwrap().list().unwrap();
html!( html!(
(DOCTYPE)
(head("sujets")) (head("sujets"))
body { body {
content { content {
@ -97,7 +95,6 @@ async fn topics(State(state): State<MainState>) -> impl IntoResponse {
async fn activity(State(state): State<MainState>) -> impl IntoResponse { async fn activity(State(state): State<MainState>) -> impl IntoResponse {
let topics = state.store.read().unwrap().activity().unwrap(); let topics = state.store.read().unwrap().activity().unwrap();
html!( html!(
(DOCTYPE)
(head("activité")) (head("activité"))
body { body {
content { content {
@ -124,7 +121,6 @@ async fn topic(Path(name): Path<String>, State(state): State<MainState>) -> impl
}; };
html!( html!(
(DOCTYPE)
(head(&name)) (head(&name))
body { body {
content { content {
@ -218,7 +214,6 @@ fn sanithize_identifier(input: &str) -> String {
async fn create() -> impl IntoResponse { async fn create() -> impl IntoResponse {
html!( html!(
(DOCTYPE)
(head("créer")) (head("créer"))
body { body {
content { content {
@ -251,7 +246,6 @@ async fn create() -> impl IntoResponse {
fn error(message: impl ToString) -> Markup { fn error(message: impl ToString) -> Markup {
let message = message.to_string(); let message = message.to_string();
html!( html!(
(DOCTYPE)
(head("Failure")) (head("Failure"))
body { body {
content { content {