diff options
author | Ryan Kavanagh <rak@rak.ac> | 2020-06-08 22:04:58 -0400 |
---|---|---|
committer | Ryan Kavanagh <rak@rak.ac> | 2020-06-08 22:04:58 -0400 |
commit | 302363f5cb90720d32245a4c849ed92a12acb719 (patch) | |
tree | 837e4ed233cc9cadd81fa250f1416ac3575efb29 /bin | |
parent | Fix parsing errors involving crlf vs eol (diff) |
Fix notty issues involving newlines
Diffstat (limited to 'bin')
-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 |