Prettify HTML output and add a hardcoded favicon path (soon to be configurable)

Signed-off-by: Izuru Yakumo <yakumo.izuru@chaotic.ninja>

git-svn-id: file:///srv/svn/repo/kosuzu/trunk@50 eb64cd80-c68d-6f47-b6a3-0ada418499da
This commit is contained in:
yakumo.izuru 2023-10-19 01:21:22 +00:00
parent d25578e58f
commit 77c597b02e

View File

@ -13,7 +13,7 @@ let init kv =
let header = to_string "HTM-header" kv in
let footer = to_string "HTM-footer" kv in
let style = match to_string "HTM-style" kv with
| Some s -> Printf.sprintf "<style>%s</style>" s | None -> "" in
| Some s -> Printf.sprintf "<style>%s</style>\n" s | None -> "" in
{ templates = { header; footer}; style }
let wrap conv htm text_title body =
@ -31,8 +31,8 @@ let wrap conv htm text_title body =
(if feed <> "" then sprintf "<a href='%s' id='feed'>feed</a>" feed else ""))
in
let footer = match htm.templates.footer with None -> "" | Some x -> replace x in
Printf.sprintf "<!DOCTYPE HTML PUBLIC \"//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\"><html><head><title>%s%s</title>\n%s\n%s\
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><meta http-equiv=\"Content-type\" content=\"text/html; charset=utf-8\"></head><body>\n%s%s%s</body></html>"
Printf.sprintf "<!DOCTYPE HTML PUBLIC \"//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n<html>\n<head>\n<link rel=\"icon\" href=\"/favicon.png\">\n<title>%s%s</title>\n%s\n%s\
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n<meta http-equiv=\"Content-type\" content=\"text/html; charset=utf-8\">\n</head>\n<body>\n%s%s%s</body>\n</html>"
text_title (if site_title <> "" then ("" ^ site_title) else "")
htm.style
(if feed <> "" then Printf.sprintf "<link rel='alternate' href='%s' type='application/atom+xml'>" feed else "")