package htmlit
HTML generation combinators for OCaml
Install
Dune Dependency
Authors
Maintainers
Sources
htmlit-0.1.0.tbz
sha512=b51050da1bdabd9dc96f362fe75d53098523146698cdd442fab1fa882ed7052a29cb61c0e68dc13631be4aef9c4cb6eec1c890e08a29372d2864a1599e49b94c
doc/index.html
Htmlit v0.1.0
Htmlit provides simple but subtle combinators to generate HTML fragments and pages.
See the quick start.
Library htmlit
Htmlit
HTML generation.
Quick start
Construct HTML fragments with the constuctors of the Htmlit.El
module and render them to strings. Here's a simple example to get you started.
open Htmlit
let abbrs =
[ "KISS", "Keep it simple, stupid";
"DRY", "Don't repeat yourself" ]
let abbrify ?(at = []) (a, exp) = El.abbr ~at:(At.title exp :: at) [El.txt a]
let page ?(footer = El.void) ~title contents =
let body = El.body [El.h1 [El.txt title]; contents; footer] in
El.page ~lang:"en" ~title body
let mypage () =
let comma = El.txt ", " in
let abbrs = El.splice ~sep:comma (List.map abbrify abbrs) in
let content = El.p [El.txt "Keep in mind: "; abbrs; El.txt "."] in
page ~title:"Hints" content
let main () = print_endline (El.to_string ~doctype:true (mypage ()))
let () = if !Sys.interactive then () else main ()
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page