diff options
Diffstat (limited to '')
-rw-r--r-- | bin/leda.ml | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/bin/leda.ml b/bin/leda.ml index 4b86330..98e6244 100644 --- a/bin/leda.ml +++ b/bin/leda.ml @@ -29,8 +29,18 @@ let () = let h = (I.string A.empty ("STATUS: " ^ (R.name_of_response r))) <-> (I.string A.empty ("STATUS LINE: " ^ (R.header_of_response r))) in let c = match r with - | SUCCESS (_, c) | SUCCESS_EOCSS (_, c) -> I.string A.empty c + | SUCCESS (_, c) | SUCCESS_EOCSS (_, c) -> + (try + let parsed = M.str_to_gemini c in + List.fold parsed + ~init:I.empty + ~f:(fun acc -> fun l -> + acc <-> (I.string A.empty (M.gemini_line_to_str l))) + with + | M.ParseError m -> + I.string A.empty ("Failed to parse contents: " ^ m)) | _ -> I.empty in + let _ = (fun _ -> ()) (h, c) in let%lwt () = Term.image t (h <-> c) in let%lwt () = Term.refresh t in loop t |