Simple F# DSL for generating statically generating HTML programmatically.
let timesTable n =
html [
head [title %(sprintf "%d Times table" n)]
body [
ul [for i in 1..12 ->
li %(sprintf "%d x %d = %d" n i (n*i)) ]
]
]
let page = timesTable 3 |> Html.toString
Outputs:
<html>
<head>
<title>3 Times table</title>
</head>
<body>
<ul>
<li>3 x 1 = 3</li>
<li>3 x 2 = 6</li>
<li>3 x 3 = 9</li>
<li>3 x 4 = 12</li>
<li>3 x 5 = 15</li>
<li>3 x 6 = 18</li>
<li>3 x 7 = 21</li>
<li>3 x 8 = 24</li>
<li>3 x 9 = 27</li>
<li>3 x 10 = 30</li>
<li>3 x 11 = 33</li>
<li>3 x 12 = 36</li>
</ul>
</body>
</html>