ireina7 / hastags

HasTags is a small, fast XML/HTML/CSS construction library for Haskell that takes fragments in plain Haskell code.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

hastags

HasTags is a small, fast XML/HTML/CSS construction library for Haskell that takes fragments in plain Haskell code.

Example

import HasTags
toHtml $
  (tag "section") [attr "class" =: "example"] [
    (tag "h2") [ 
      (tag "span") [attr "style" =: "color:red;"] [raw "A simple example"]
    ]
  ]

above can be simplified to

import HasTags
import HasTags.Data.Tags (section, h2)
import HasTags.Data.Attributes (cls, style)
import qualified HasTags.Data.Tags as Tags
import qualified HasTags.Data.Attributes as Attrs
toHtml $
  section[cls =: "example"] 
    [ h2[Tags.span[style =: "color:red;"] [text "A simple example"]]
    ]

output

<section class="example">
  <h2>
    <span style="color:red;">A simple example</span>
  </h2>
</section>

About

HasTags is a small, fast XML/HTML/CSS construction library for Haskell that takes fragments in plain Haskell code.

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Haskell 100.0%