This is a general web page scaffold written in Haskell for the Lucid Html DSL.
It's pretty straigt forward:
λ> renderText $ template def "some content"
"<!DOCTYPE HTML><html><head><title></title><link href rel="icon"></head><body>some content</body></html>"
overload the particular areas with record syntax, or do whatever:
λ> let page = def {pageTitle = "foo", bodyScripts = script_ [src_ "jquery.js"] ""}
λ> template page "some content"
"<!DOCTYPE HTML><html><head><title>foo</title><link href rel=\"icon\"></head><body>some content<script src=\"jquery.js\"></script></body></html>"
Note: When using the Hastache implementation, the content inside a
WebPage
data type will be in the same scope as the rest of the template - you can access the things your final content will see frommetaVars
, for instance (unless you do multiple renderings).
Another Note: We don't provide an instance for the beloved Hamlet because under the hood, it's just Blaze-Html -
$(runQ $ shamletFile "foo.hamlet")
gives us anHtml
.
Fork, Pull-Request, repeat.