File: minihtml.ml

package info (click to toggle)
tyxml 4.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 944 kB
  • sloc: ml: 9,712; makefile: 91; javascript: 3
file content (26 lines) | stat: -rw-r--r-- 499 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
open Tyxml

let%html mycontent = {|
  <div class="content">
    <h1>A fabulous title</h1>
    This is a fabulous content.
  </div>
|}


let mytitle = Html.txt "A Fabulous Web Page"

let%html mypage =
  {|<html>
     <head>
       <title>|}mytitle{|</title>
     </head>
     <body>|}[mycontent]{|</body>
   </html>
  |}

let () =
  let file = open_out "index.html" in
  let fmt = Format.formatter_of_out_channel file in
  Format.fprintf fmt "%a@." (Html.pp ~indent:true ()) mypage;
  close_out file