[Haskell-cafe] ANN: HStringTemplate 0.2

Sterling Clover s.clover at gmail.com
Sat Jan 26 23:01:12 EST 2008


HStringTemplate is a general purpose templating system, geared  
especially towards HTML and based on Terrence Parr’s Java library.

On Hackage at: http://hackage.haskell.org/cgi-bin/hackage-scripts/ 
package/HStringTemplate-0.2

Development version at: darcs get http://code.haskell.org/ 
HStringTemplate/

Haddocks at: http://code.haskell.org/HStringTemplate/dist/doc/html/ 
HStringTemplate/Text-StringTemplate.html

Additional documentation on the grammar at: http://www.antlr.org/wiki/ 
display/ST/StringTemplate+3.1+Documentation as well as in some posts  
at http://fmapfixreturn.wordpress.com

Lots of cleanup, lots of additions, hopefully this is an extremely  
usable release. Still no group or interface files, but I suspect that  
those are mainly useful for code-generation, which seems like  
something Haskell programmers would want to use something other than  
a templating system for in any case.

On to the good stuff:

     * Now on hackage!
     * Generics. Not one but two types. One set of simple bindings  
for the standard Data class, and one for syb-with-class. (Alex  
Drummond’s RJson library, which is really cool, was very helpful in  
figuring out how to do this).
     * A withContext method that turns any set of name-value bindings  
into the context for a StringTemplate. Along with the syb-with-class  
bindings, this should make for relatively seamless interoperability  
with HAppS.
     * Lots of other additional bindings for working with standard  
time formats, numeric types, etc.
     * Encoders. A standard mechanism for HTML-escaping strings (or  
javascript-escaping, or urlencoding them, or etc.) that A) ensures it  
happens uniformly and B) ensures it happens no more than once.
     * Improved pretty printing support, eliminating corner-cases  
where wrapping did not occur.
     * Creation of directory groups is now done properly in the IO  
monad, with caching functionality moved to the scarily-named  
unsafeVolatileDirectoryGroup.
     * 80% Top-Level testing coverage in the base. (And more to come,  
but I only have so much time).

And of course, patches and feedback always welcome.

--Sterl


More information about the Haskell-Cafe mailing list