View on GitHub

Cinder

Markup and DOM manipulation DSL for Fay

Download this project as a .zip file Download this project as a tar.gz file

HTML Table

The table at the bottom of the page (Welcome to 1997!) was created on the fly by the following Fay:

colors :: [[String]]
colors = go [ (r,g,b) | r <- s, g <- s, b <- s]
    where s = [0, 0x33 .. 0xff]
          go [] = []
          go xs = map rgb (take 24 xs) : go (drop 24 xs)

tableMU :: Markup
tableMU = markup ! table !+ foldl1 (!+) (map row colors) ! Complete
    where row x = markup ! tr !+ foldl1 (!+) (map box x) ! Complete
          box x = markup ! td ! sty x ! inner "&#955;" ! Complete
          sty x = style ("height:20px;width:20px;background-color:" ++ x)

htex :: Fay ()
htex = root >>= byTag "body" >>= zipWithM_ insert [tableMU]

(If you don't understand the ! and !+ stuff, look at the SVG examples and the README. This example just demonstrates the applicability to HTML.)

I won't bother to explain the HTML or the Haskell to you, as, if you're reading this, you're probably more expert than I am at both.

The are only a few points of note as regards Cinder:

And, after the footer, behold our amazing technicolor dreamtable: