In-Reply-To header field. Note extra list.rev in convert

git-svn-id: file:///srv/svn/repo/kosuzu/trunk@41 eb64cd80-c68d-6f47-b6a3-0ada418499da
This commit is contained in:
fox
2022-12-13 23:04:19 +00:00
parent da47c68af6
commit 3e971f40dc
5 changed files with 55 additions and 33 deletions

View File

@@ -39,14 +39,14 @@ let wrap conv htm text_title body =
(if feed <> "" then Printf.sprintf "<link rel='alternate' href='%s' type='application/atom+xml'>" feed else "")
header body footer
let topic_link root topic =
let topic_link root topic =
let replaced_space = String.map (function ' '->'+' | x->x) in
"<a href='index." ^ root ^ ".htm#" ^ replaced_space topic ^ "'>"
^ String.capitalize_ascii topic ^ "</a>"
module HtmlConverter = struct
include Converter.Html
let uid_uri u a = Printf.sprintf "%s<a href='%s%s'>%s</a>" a u ext u
let uid_uri u a = Printf.sprintf "%s<a href='%s%s'>&lt;%s&gt;</a>" a u ext u
let angled_uri u a =
if try String.sub u 0 10 = "urn:txtid:" with Invalid_argument _ -> false
then angled_uri (String.(sub u 10 (length u - 10)) ^ ext) a else angled_uri u a
@@ -73,6 +73,7 @@ let page htm conversion text =
let link l = HtmlConverter.uid_uri l "" in
String_set.fold (fun r a -> sep_append a (link r)) x ""
in
Printf.eprintf "%s %d\n" text.id (Conversion.Id_map.cardinal conversion.Conversion.replies);
"<article><header><dl>"
^ opt_kv "Title:" text.title
^ opt_kv "Authors:" authors
@@ -81,9 +82,13 @@ let page htm conversion text =
^ opt_kv "Topics:" (topic_links (set "topics" text))
^ opt_kv "Id:" text.id
^ opt_kv "Refers:" (ref_links (set "references" text))
^ opt_kv "In reply to:" (ref_links (set "in-reply-to" text))
^ opt_kv "Referred by:" (try
ref_links (Conversion.Id_map.find text.id conversion.Conversion.references)
with Not_found -> "")
^ opt_kv "Replies:" (try
ref_links (Conversion.Id_map.find text.id conversion.Conversion.replies)
with Not_found -> "empty replies")
^ {|</dl></header><pre style="white-space:pre-wrap">|} in
wrap conversion htm text.title ((T.of_string text.body header) ^ "</pre></article>")