Omit bullet in empty title conversions, tidy html.ml

This commit is contained in:
orbifx 2022-10-22 21:55:08 +01:00
parent 93be78f7c9
commit 4c32abf03b
1 changed files with 111 additions and 110 deletions

View File

@ -7,12 +7,11 @@ let default_opts = { templates = empty_templates }
let init kv =
let open Logarion in
let header = match Store.KV.find "HTM-header" kv with
| fname -> Some (File_store.to_string fname)
| exception Not_found -> None in
let footer = match Store.KV.find "HTM-footer" kv with
let to_string key kv = match Store.KV.find key kv with
| fname -> Some (File_store.to_string fname)
| exception Not_found -> None in
let header = to_string "HTM-header" kv in
let footer = to_string "HTM-footer" kv in
{ templates = { header; footer} }
let wrap c htm text_title body =
@ -28,11 +27,13 @@ let wrap c htm text_title body =
"</a><nav><a href='feed.atom' id='feed'>feed</a></nav></header>"
in
let footer = match htm.templates.footer with None -> "" | Some x -> replace x in
"<!DOCTYPE HTML><html><head><title>" ^ text_title ^ "" ^ site_title ^ "</title>\n\
Printf.sprintf "<!DOCTYPE HTML><html><head><title>%s%s</title>\n\
<link rel='stylesheet' href='main.css'>\
<link rel='alternate' href='feed.atom' type='application/atom+xml'>\
<meta charset='utf-8'/><meta name='viewport' content='width=device-width, initial-scale=1.0'>\
</head><body>\n" ^ header ^ body ^ footer ^ "</body></html>"
</head><body>\n%s%s%s</body></html>"
text_title (if site_title <> "" then ("" ^ site_title) else "")
header body footer
let topic_link root topic =
let replaced_space = String.map (function ' '->'+' | x->x) in