Skip to content

ptrelford/FsHtml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FsHtml

Simple F# DSL for generating statically generating HTML programmatically.

Building

  • Appveyor: Build status
  • Travis: Build Status

Example

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>

About

F# based HTML DSL for generating static HTML programmatically

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages