Relation dates, with conversion condition upon it

git-svn-id: file:///srv/svn/repo/kosuzu/trunk@43 eb64cd80-c68d-6f47-b6a3-0ada418499da
This commit is contained in:
fox
2022-12-18 14:49:25 +00:00
parent 4dff69cb4a
commit 9587b7173a
7 changed files with 91 additions and 65 deletions

View File

@@ -73,7 +73,12 @@ 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);
let references, replies = let open Conversion in
let Rel.{ref_set; rep_set; _} =
try Rel.Id_map.find text.id conversion.relations
with Not_found -> Rel.empty in
ref_links ref_set, ref_links rep_set
in
"<article><header><dl>"
^ opt_kv "Title:" text.title
^ opt_kv "Authors:" authors
@@ -83,12 +88,8 @@ let page htm conversion 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 -> "")
^ 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>")