feat: render wml decks with paginated card sub-documents

This commit is contained in:
randogoth 2026-10-04 21:04:49 +03:00
parent 36b868e094
commit 1de4674b09
17 changed files with 1519 additions and 5 deletions

View file

@ -139,6 +139,30 @@ pub fn serve(listener: &Listener, mut stream: TcpStream) -> Result<()> {
}
respond(&mut stream, 200, "OK", listener.media_type(&format), body, &headers, head_only)
}
Ok(Resolution::Found(Resource::Part { parent_url, slug, page })) => {
match page.part(&format, &slug) {
Some(body) => respond(
&mut stream,
200,
"OK",
listener.media_type(&format),
body,
&[("Vary", "Accept")],
head_only,
),
// This format does not address that sub-document, so the parent
// is where the content actually is.
None => respond(
&mut stream,
301,
"Moved Permanently",
"text/plain; charset=utf-8",
b"",
&[("Location", parent_url.as_str()), ("Vary", "Accept")],
head_only,
),
}
}
Ok(Resolution::Found(Resource::Raw { path, media_type })) => {
let meta = std::fs::metadata(&path)?;
write_head(&mut stream, 200, "OK", media_type, meta.len(), &[])?;