tangled
alpha
login
or
join now
jon.recoil.org
/
mime_printer
0
fork
atom
this repo has no description
0
fork
atom
overview
issues
pulls
pipelines
Initial commit
jon.recoil.org
3 years ago
1d232bb8
+41
4 changed files
expand all
collapse all
unified
split
dune
dune-project
mime_printer.ml
mime_printer.opam
+4
dune
···
1
1
+
(library
2
2
+
(name mime_printer)
3
3
+
(public_name mime_printer))
4
4
+
+2
dune-project
···
1
1
+
(lang dune 2.0)
2
2
+
+19
mime_printer.ml
···
1
1
+
type encoding = Noencoding | Base64
2
2
+
type t = { mime_type : string; encoding : encoding; data : string }
3
3
+
4
4
+
let dummy = { mime_type="text/odoc"; encoding=Noencoding; data="hello"}
5
5
+
let outputs : t list ref = ref []
6
6
+
7
7
+
let push ?(encoding = Noencoding) mime_type data =
8
8
+
outputs := { mime_type; encoding; data } :: !outputs
9
9
+
10
10
+
let get () =
11
11
+
let result = !outputs in
12
12
+
outputs := [];
13
13
+
result
14
14
+
15
15
+
let to_odoc x =
16
16
+
match String.split_on_char '/' x.mime_type, x.encoding with
17
17
+
| "image"::_, Base64 -> Printf.sprintf "{%%html: <img src=\"data:%s;base64,%s\" /> %%}" x.mime_type x.data
18
18
+
| "text"::"odoc"::[], Noencoding -> x.data
19
19
+
| _ -> ""
+16
mime_printer.opam
···
1
1
+
version: "0.0.1"
2
2
+
opam-version: "2.0"
3
3
+
maintainer: "jon@recoil.org"
4
4
+
authors: "various"
5
5
+
license: "ISC"
6
6
+
depends: [
7
7
+
"ocaml" (>= "4.04")
8
8
+
]
9
9
+
build : [
10
10
+
["dune" "subst"] {pinned}
11
11
+
["dune" "build" "-p" name "-j" jobs]
12
12
+
]
13
13
+
synopsis: "Mime printer"
14
14
+
description: """
15
15
+
Mime printer for toplevels
16
16
+
"""