Switch HTML doctype to 4.01 Transitional, update documentation
Signed-off-by: Izuru Yakumo <yakumo.izuru@chaotic.ninja> git-svn-id: file:///srv/svn/repo/kosuzu/trunk@48 eb64cd80-c68d-6f47-b6a3-0ada418499da
This commit is contained in:
33
cli/html.ml
33
cli/html.ml
@@ -27,13 +27,12 @@ let wrap conv htm text_title body =
|
||||
then "feed.atom" else "" in
|
||||
let header = match htm.templates.header with
|
||||
| Some x -> replace x
|
||||
| None -> Printf.(sprintf "<header><a href='.'>%s</a>%s</header>" site_title
|
||||
(if feed <> "" then sprintf "<nav><a href='%s' id='feed'>feed</a></nav>" feed else ""))
|
||||
| None -> Printf.(sprintf "<a href='.'>%s</a>%s" site_title
|
||||
(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><html><head><title>%s%s</title>\n%s\n%s\
|
||||
<meta charset='utf-8'/><meta name='viewport' content='width=device-width, initial-scale=1.0'>\
|
||||
</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\"><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>"
|
||||
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 "")
|
||||
@@ -62,7 +61,7 @@ let page htm conversion text =
|
||||
(* let author acc auth = sep_append acc Person.(auth.name ^ " ") in*)
|
||||
let authors = Person.Set.to_string text.authors in
|
||||
let header =
|
||||
let time x = Printf.sprintf {|<time datetime="%s">%s</time>|}
|
||||
let time x = Printf.sprintf {|<span class="%s">%s</span>|}
|
||||
(Date.rfc_string x) (Date.pretty_date x) in
|
||||
let topic_links x =
|
||||
let to_linked t a =
|
||||
@@ -79,7 +78,7 @@ let page htm conversion text =
|
||||
with Not_found -> Rel.empty in
|
||||
ref_links ref_set, ref_links rep_set
|
||||
in
|
||||
"<article><header><dl>"
|
||||
"<dl>"
|
||||
^ opt_kv "Title:" text.title
|
||||
^ opt_kv "Authors:" authors
|
||||
^ opt_kv "Date:" (time (Date.listing text.date))
|
||||
@@ -90,8 +89,8 @@ let page htm conversion text =
|
||||
^ opt_kv "In reply to:" (ref_links (set "in-reply-to" text))
|
||||
^ opt_kv "Referred by:" references
|
||||
^ opt_kv "Replies:" replies
|
||||
^ {|</dl></header><pre style="white-space:pre-wrap">|} in
|
||||
wrap conversion htm text.title ((T.of_string text.body header) ^ "</pre></article>")
|
||||
^ {|</dl><pre style="white-space:pre-wrap">|} in
|
||||
wrap conversion htm text.title ((T.of_string text.body header) ^ "</pre>")
|
||||
|
||||
let to_dated_links ?(limit) meta_list =
|
||||
let meta_list = match limit with
|
||||
@@ -115,9 +114,9 @@ let date_index ?(limit) conv htm meta_list =
|
||||
|
||||
let fold_topic_roots topic_roots =
|
||||
let list_item root t = "<li>" ^ topic_link root t in
|
||||
"<nav><h2>Main topics</h2>"
|
||||
"<h2>Main topics</h2>"
|
||||
^ List.fold_left (fun a x -> a ^ list_item x x) "<ul>" (List.rev topic_roots)
|
||||
^ "</ul></nav>"
|
||||
^ "</ul>"
|
||||
|
||||
let fold_topics topic_map topic_roots metas =
|
||||
let open Logarion in
|
||||
@@ -134,14 +133,14 @@ let fold_topics topic_map topic_roots metas =
|
||||
in
|
||||
"<li>" ^ item ^ sub_items root t
|
||||
in
|
||||
"<nav><h2>Topics</h2>"
|
||||
"<h2>Topics</h2>"
|
||||
^ List.fold_left (fun a x -> a ^ list_item x x) "<ul>" (List.rev topic_roots)
|
||||
^ "</ul></nav>"
|
||||
^ "</ul>"
|
||||
|
||||
let text_item path meta =
|
||||
let open Logarion in
|
||||
"<time>" ^ Date.(pretty_date (listing meta.Text.date))
|
||||
^ {|</time> <a href="|} ^ path ^ Text.short_id meta ^ {|.htm">|} ^ meta.Text.title
|
||||
"<span>" ^ Date.(pretty_date (listing meta.Text.date))
|
||||
^ {|</span> <a href="|} ^ path ^ Text.short_id meta ^ {|.htm">|} ^ meta.Text.title
|
||||
^ "</a><br>"
|
||||
|
||||
let listing_index topic_map topic_roots path metas =
|
||||
@@ -161,12 +160,12 @@ let listing_index topic_map topic_roots path metas =
|
||||
| "" -> ""
|
||||
| x -> {|<h2 id="|} ^ topic ^ {|">|} ^ String.capitalize_ascii topic ^ "</h2>" ^ x
|
||||
in
|
||||
"<nav><h1>Texts</h1>" ^ item_group topic_roots ^ "</nav>"
|
||||
"<h1>Texts</h1>" ^ item_group topic_roots ^ ""
|
||||
|
||||
let topic_main_index conv htm topic_roots metas =
|
||||
wrap conv htm "Topics"
|
||||
(fold_topic_roots topic_roots
|
||||
^ "<nav><h1>Latest</h1><ul>" ^ to_dated_links ~limit:8 metas
|
||||
^ "<h1>Latest</h1><ul>" ^ to_dated_links ~limit:8 metas
|
||||
^ {|</ul><a href="index.date.htm">More by date</a>|}
|
||||
^ let peers = try Logarion.Store.KV.find "Peers" conv.kv with Not_found -> "" in
|
||||
(if peers = "" then "" else
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
let version = "9333d0e-dirty"
|
||||
let version = "1.2"
|
||||
|
||||
open Cmdliner
|
||||
let default_cmd =
|
||||
|
||||
Reference in New Issue
Block a user