English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2010-11-23 (13:06)
From: Thomas Gazagnaire <thomas.gazagnaire@i...>
Subject: [ANN] HTCaML / CaSS
I am happy to announce the first official release of HTCaML[1] and
CaSS[2], two small libraries which make the writing of static web pages
easy in OCaml.

HTCaML enables the embedding of XHTML fragments in your OCaml program
(the EDSL translates directly to Xmlm) using quotations. It also allows
you to auto-generate boilerplate XHTML fragments from type definitions.
In the same way, CaSS enables the embedding of CSS fragments in your
OCaml program using quotations.

A quick example:

module Box = struct
  type t = { title: string; date: string; contents: Html.t } with html
  let css fg bg = <:css<
     color: $fg$;
     background-color: $bg$;
     .title { color: $bg$; background-color: $fg$; }

let my_html boxes = Html.to_string <:html<
      <div class="boxes">
        $list:List.map Box.html_of_t boxes$

let my_css = Css.to_string <:css<
   .boxes { $Box.css <:css< blue >> <:css< white >> $ }

You can find a quick introduction to HTCaML (and maybe soon to CaSS) on
the mirage blog[3].


[1] https://github.com/samoht/htcaml
[2] https://github.com/samoht/cass
[3] http://www.openmirage.org/blog/introduction-to-htcaml