forked from zapashcanon/pellest
23 lines
668 B
OCaml
23 lines
668 B
OCaml
open Tyxml
|
|
|
|
let generic ~page_title ~scripts content =
|
|
let open Html in
|
|
let head =
|
|
head
|
|
(title (txt page_title))
|
|
( [ link ~rel:[ `Icon ] ~href:"/assets/img/favicon.png" ()
|
|
; link ~rel:[ `Stylesheet ] ~href:"/assets/css/style.css" ()
|
|
]
|
|
@ scripts )
|
|
in
|
|
let body = body [ main [ div [ content ] ] ] in
|
|
let page = html head body in
|
|
Format.asprintf "%a@." (pp ~indent:true ()) page
|
|
|
|
let render ~title ~scripts content =
|
|
Dream.html @@ generic ~page_title:title ~scripts content
|
|
|
|
let err (status, msg) =
|
|
let code = Dream.status_to_int status in
|
|
Dream.html ~code @@ generic ~page_title:"Error" ~scripts:[] (Html.txt msg)
|