Skip to content

Commit f16291b

Browse files
committed
use Html5.P.print as suggested by @Drup on IRC
1 parent 00c6226 commit f16291b

1 file changed

Lines changed: 4 additions & 14 deletions

File tree

‎page.ml‎

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
11
open Html5.M
22

3-
module StringPrinter = struct
4-
type out = string
5-
type m = string
6-
7-
let empty = ""
8-
let concat = (^)
9-
let put a = a
10-
let make a = a
11-
end
12-
13-
module StringHtml = Html5.Make_printer(StringPrinter)
14-
153
let header title =
164
head
175
(Html5.M.title (pcdata title))
@@ -134,7 +122,9 @@ let content =
134122
]
135123

136124
let render =
137-
Cstruct.of_string @@ StringHtml.print @@
125+
let buf = Buffer.create 500 in
126+
Html5.P.print ~output:(Buffer.add_string buf) @@
138127
html
139128
(header "not quite so broken")
140-
(body [ content ])
129+
(body [ content ]) ;
130+
Cstruct.of_string @@ Buffer.contents buf

0 commit comments

Comments
 (0)