better pp_thread

This commit is contained in:
Swrup 2022-02-22 00:29:31 +01:00
parent bb57aec4be
commit d68e6e0fd7

View file

@ -152,8 +152,8 @@ let pp_thread fmt op posts =
let thread_data, _post = op in let thread_data, _post = op in
(*order by date *) (*order by date *)
let posts = List.sort (fun a b -> compare a.date b.date) posts in let posts = List.sort (fun a b -> compare a.date b.date) posts in
let posts_view = let posts_view fmt () =
Format.asprintf "%a" Format.fprintf fmt "%a"
(Format.pp_print_list ~pp_sep:Format.pp_print_space (fun fmt post -> (Format.pp_print_list ~pp_sep:Format.pp_print_space (fun fmt post ->
pp_post fmt (Post post) ) ) pp_post fmt (Post post) ) )
posts posts
@ -165,11 +165,11 @@ let pp_thread fmt op posts =
%s %s
</div> </div>
<div class="thread-posts"> <div class="thread-posts">
%s %a
</div> </div>
</div> </div>
|} |}
thread_data.subject posts_view thread_data.subject posts_view ()
let view_thread thread_id = let view_thread thread_id =
let* op = get_op thread_id in let* op = get_op thread_id in