this repo has no description
1type encoding = Noencoding | Base64
2type t = { mime_type : string; encoding : encoding; data : string }
3
4let dummy = { mime_type="text/odoc"; encoding=Noencoding; data="hello"}
5let outputs : t list ref = ref []
6
7let push ?(encoding = Noencoding) mime_type data =
8 outputs := { mime_type; encoding; data } :: !outputs
9
10let get () =
11 let result = !outputs in
12 outputs := [];
13 result
14
15let to_odoc x =
16 match String.split_on_char '/' x.mime_type, x.encoding with
17 | ["image"; "svg"], Noencoding -> Printf.sprintf "{%%html: %s %%}" x.data
18 | "image"::_, Base64 -> Printf.sprintf "{%%html: <img src=\"data:%s;base64,%s\" /> %%}" x.mime_type x.data
19 | "text"::"odoc"::[], Noencoding -> x.data
20 | _ -> ""