Miguel Mitrofanov | 31 Oct 07:40 2012
Picon

ANNOUNCE: plat

My current project at work has a web interface. Therefore I needed an HTML templating library. I've tried
several and found them all unsatisfactory. Most of them generate Haskell code from templates (with
Template Haskell or a separate utility), and I don't like metaprogramming; and recompiling the program
every time you make a small change in the template kinda defeats the purpose. Other libraries make it PITA
to implement basic things, like iterating over an array. So, I'm proud to announce the first release of
another template library: plat-0.1.0.1 (http://hackage.haskell.org/package/plat).

An example of what it does. If your data looks like

do "name" =: "Mac's tools"
   "staff" =: [
    do "index" =: "1"
       "name" =: "Alice"
    ,
    do "name" =: "Bob"
       "index" =: "2"
       "bad" =: True
    ,
    do "index" =: "3"
       "name" =: "Nicolás"
    ]

and your template is

List of employees at  <at> name:
 <at> staff[person
 <at> person.index <at> ..  <at> person.name <at> { <at> !person.bad (going to be fired) <at> | <at> } <at> 
 <at> ] <at> # There won't be an empty line in the result

Then the result you get would be this:
(Continue reading)


Gmane